Re: [PHP-DB] PHP MySQL and updating
Jennifer, I am having trouble with updating. How do I tell php to update the database at mid night instead of every time the browser is refreshed? I have looked for it but can't find the info. You would need to have your code check the time and decide whether or not to run the query. I can think of 2 different ways to do this. First, you could just build a condition in your SQL WHERE clause to check the system time to see if it's appropriate. This way would be a bit slower because it would actually have to connect to mysql and execute the statement whether it updates or not. The other way would be to put your query in a php condition block and use the php date function. Also I thought session ID's were different between users. Is this true? Yes, this is true. If it were not then you would have users with the same session which would be amusing. A session ID is unique though eventually it will be reused I believe. Hope that helps. Jason Cox -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] If Statement that makes me cry
This script is confusing the hell out of me... What its suppose to do is do a search on documents, and then is it finds something say who and where it is, but it repeats the message for every hit. Same goes with the message when there is no results, it repeats it for every record. All I want it do is say The results for $kw the list here then when no results are returned, just say the message once.. the results for $kw returned zero results. here is the script ? include variables.php; $delimiter = ,; $connection = @mysql_connect($databaseserver, $databaseuser, $databasepass) or die (could not connect to database); $db = @mysql_select_db($databasename, $connection) or die(Could not select database); $sql = SELECT id, FirstName, LastName, ResumeUp FROM $canidatetable; $result = mysql_query($sql, $connection) or die(Couldn't execute query); while ($row = mysql_fetch_array($result)) { $id = $row['id']; $FirstName = $row['FirstName']; $LastName = $row['LastName']; $filename = /home/sites/madden.williamsen.net/web/recruiter/resumes/ .$row['ResumeUp']; $fd = fopen($filename,r); $contents = fread($fd, filesize($filename)); $keywords = explode( $delimiter, $words ); for ($i=0; $i count($keywords); $i++) { $kw = $keywords[$i]; = THE TROUBLE SPOT = if( eregi($kw, $contents) ) { echo The Words $kw has been found in the resume of a href=\show_can.php?id=$id\$LastName, $FirstName/a br; } else { echo Your Search Returned Zero Recordsbr; } } } === == fclose($fd); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] If Statement that makes me cry
hi A few thoughts Firstly wouldn't it be easier to store the resumes in the database? then 'SELECT * from table where cand_resume_text LIKE %keyword[1]% or cand_resume_text LIKE %keyword[2]% bit inefficient but it works, and opening lots of files is also inefficient. or SELECT * from table while ($row = mysql_fetch_array($result)) { $found_it=0; for keywords { if(eregi($kw, $row[resume_text])) { $found_it=1; $found_one=1; } }//end for if($found_it==1) print(.) }//end while if(!$found_one) print failed (I always mark the end of a bracket set, makes debugging easier...) For your code.. you are printing the result after every keyword check, which will be serveral times per record, if you have more than one keyword. Mark success or not by setting a variable and print only when $found_it==1, resetting $found_it after each loop ; while ($row = mysql_fetch_array($result)) { $found_it=0; $id = $row['id']; $FirstName = $row['FirstName']; $LastName = $row['LastName']; $filename = /home/sites/madden.williamsen.net/web/recruiter/resumes/ .$row['ResumeUp']; $fd = fopen($filename,r); $contents = fread($fd, filesize($filename)); $keywords = explode( $delimiter, $words ); for ($i=0; $i count($keywords); $i++) { $kw = $keywords[$i]; if( eregi($kw, $contents) ) { $found_it=1; //set var to show a success - don't reset $found_at_least_one=1; }//end if }//end for if($found_it==1) { echo The Words $kw has been found in the resume of a href=\show_can.php?id=$id\$LastName, $FirstName/a br; }//end if }//end while if(!$found_at_least_one) echo Your Search Returned Zero Recordsbr; hth Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- -Original Message- From: Todd Williamsen [mailto:[EMAIL PROTECTED]] Sent: 10 February 2002 16:54 To: [EMAIL PROTECTED] Subject: [PHP-DB] If Statement that makes me cry This script is confusing the hell out of me... What its suppose to do is do a search on documents, and then is it finds something say who and where it is, but it repeats the message for every hit. Same goes with the message when there is no results, it repeats it for every record. All I want it do is say The results for $kw the list here then when no results are returned, just say the message once.. the results for $kw returned zero results. here is the script ? include variables.php; $delimiter = ,; $connection = @mysql_connect($databaseserver, $databaseuser, $databasepass) or die (could not connect to database); $db = @mysql_select_db($databasename, $connection) or die(Could not select database); $sql = SELECT id, FirstName, LastName, ResumeUp FROM $canidatetable; $result = mysql_query($sql, $connection) or die(Couldn't execute query); while ($row = mysql_fetch_array($result)) { $id = $row['id']; $FirstName = $row['FirstName']; $LastName = $row['LastName']; $filename = /home/sites/madden.williamsen.net/web/recruiter/resumes/ .$row['ResumeUp']; $fd = fopen($filename,r); $contents = fread($fd, filesize($filename)); $keywords = explode( $delimiter, $words ); for ($i=0; $i count($keywords); $i++) { $kw = $keywords[$i]; = THE TROUBLE SPOT = if( eregi($kw, $contents) ) { echo The Words $kw has been found in the resume of a href=\show_can.php?id=$id\$LastName, $FirstName/a br; } else { echo Your Search Returned Zero Recordsbr; } } } === == fclose($fd); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Outputing Distinct rows
What you *should* do is have a lastUpdated field in your posts table, and the value inserted into their is the date when you update it. Then your query would be like $sql = SELECT posts.topic_id, posts.forum_id, topics.topic_title, topics.topic_replies WHERE topics.topic_id = posts.topic_id ORDER BY posts.lastUpdated DESC LIMIT 10; Also, this would allow for extra things in the future, such as a page showing all updates in a certain day, or within last 3 days, or something like that. Hope this helps. Adam -Original Message- From: KingZeus [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 10, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: Outputing Distinct rows I'll give you all the short version of what I need and if it is enough for you to help that would be great. I need to pull the last 10 updated topics from a table and output them. However, the posts table lists each post and then has a topic id. There is also a table of topics with topic id, title, etc. I cannot just pull the last 10 posts in the post table because those posts could all be for the same topic and I'm trying to output the last 10 updated topics (not posts). How can I do this? I can't find anything on the subject. This is what I tried as a random guess: $sql = SELECT DISTINCT posts.topic_id, posts.forum_id, topics.topic_title, topics.topic_replies WHERE topics.topic_id = posts.topic_id DESC LIMIT 10; Any ideas about what I need to do? I'm sure it is pretty simple. Regards, Steve KingZeus Downs Co-Webmaster: http://www.cncrenegade.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Magic quotes sybase
Hi, can I enabled or disabled magic_quotes_sybase at runtime? Or is there any workaround so character (') doesn't treated as (''), because of magic_quotes_sybase ? Thanks, -- Adi Wibowo -- http://dewey.petra.ac.id * Work matter: [EMAIL PROTECTED] * Private matter : [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] javascipt window
I am wondering why the following will not launch a window using javascript. I have tried escaping the Html at various points with no success: echo td ALIGN='CENTER'a href='javascript:launchwin('$row[5].htm','newwindow','height=480,width=640') '.$format./a/td/tr; the href works fine when I am linking to a normal page. Thanks for any help. -- Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] javascipt window
Mike, you have a conflict with your different quote-styles, have a look at the source code when you output that and you will see what i mean, you need to do something like this; echo td ALIGN=\CENTER\a href=\javascript:launchwin('$row[5].htm','newwindow','height=480,width=640' );\.$format./a/td/tr; HTH Beau // -Original Message- // From: Mike [mailto:[EMAIL PROTECTED]] // Sent: Monday, 11 February 2002 11:39 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] javascipt window // // // I am wondering why the following will not launch a window // using javascript. // I have tried escaping the Html at various points with no success: // // echo td ALIGN='CENTER'a // href='javascript:launchwin('$row[5].htm','newwindow','height= // 480,width=640') // '.$format./a/td/tr; // // the href works fine when I am linking to a normal page. // Thanks for any help. // -- // Mike // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascipt window
Hi, Thanks, that worked fine Mike Beau Lebens [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Mike, you have a conflict with your different quote-styles, have a look at the source code when you output that and you will see what i mean, you need to do something like this; echo td ALIGN=\CENTER\a href=\javascript:launchwin('$row[5].htm','newwindow','height=480,width=640' );\.$format./a/td/tr; HTH Beau // -Original Message- // From: Mike [mailto:[EMAIL PROTECTED]] // Sent: Monday, 11 February 2002 11:39 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] javascipt window // // // I am wondering why the following will not launch a window // using javascript. // I have tried escaping the Html at various points with no success: // // echo td ALIGN='CENTER'a // href='javascript:launchwin('$row[5].htm','newwindow','height= // 480,width=640') // '.$format./a/td/tr; // // the href works fine when I am linking to a normal page. // Thanks for any help. // -- // Mike // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php