Re: [PHP-DB] Cookies
I believe that the cookie part needs to be sent to the browser before the html. You can put the set cookies any where in the php portion as long as the first thing you send is the cookie stuff setcookie.. html header info... html not html header info. setcookie html.. Hopes this helps John On Wed, 25 Apr 2001, Tobbe wrote: Hi !! I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I used the code example from the php manual from php.net put I only get the error messages (down below) And how do i get back the var in to the page or is there another beter way to save the variables when reloading the page ___ setcookie (cookie[two], $iCount); setcookie (cookie[one], $sPhone); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { echo $name == $valuebr\n; } } __ Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51 Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52 Thanks / Tobbe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySql select and insert
Ok here is my problem. I have this database and the key is comprised of two fields, filename and path to file. When I read based on this key, I get 0 records found. When I insert the same record, it will say that the key already exists.(which id does). Why can't MySql findthe record. Also when I log into MySql and type the search in manually, it doesnot find it, then when I put a wild card at the end of the path and use like MySql finds the record. The File name and Path are derived from the system so it is not atyping error. Any know what is up with it Thanks John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Variable passing
Use sessions. This will store the values on the server rather than passing them back and forth. Lots less typing too. On Tue, 24 Apr 2001, Johannes Janson wrote: You can output the passed varibles from the previous page in an input type=hidden in the form of the following page. Johannes Brinzoi Constantin Aurelian [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi ! Here is the problem: I got 8 pages, shown one after another. Each have 2 buttons (one for continue and one for abort). When I click to Continue I go to the next page. On the last page I have to submit ALL variables from these 8 pages to the database. My test shown that only the variables from the last page are filled-in and otherones are empty. I have tried with another php page that includes all 8 - include(page...). Worthless! What can I do? TIA, Constantin Brinzoi Dept. Sondaje IRECSON -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] trouble reading a database (fwd)
Below is the output and code for my problem. When the database gets read, it returns 0 rows. When it writes, it says it can't because of duplicate entry. FLD_FileName and FDL_Path are the Primary key. Two questions, what I am doing wrong and is there a better way to create a string of text then the one used below. TIA John Read_sql SELECT * FROM TBL_Picture WHERE FLD_FileName = SailBoat.jpgand FLD_Path = /var/www/html/slidecollection/WinterCarnival Result of read Resource id #2 Error Results 0 Number or Rows 0 Insert Sql INSERT INTO TBL_Picture VALUES (SailBoat.jpg,/var/www/html/slidecollection/WinterCarnival, 1234,gfgfdgfddg,gfdgfd) Error Results Duplicate entry '/var/www/html/slidecollection/WinterCarnival-SailBoat.jpg' for key 1Result is of 2 is //reading the database to see if record already exists $result = mysql_select_db (Picture_DB, $link) or die (Could not get the database); $read_sql = SELECT * FROM TBL_Picture WHERE FLD_FileName = \; $read_sql .= $fn_FileName; $read_sql .= \and FLD_Path =\ ; $read_sql .= $fn_Path; $read_sql .= \; echo Read_sql ; echo $read_sql; $result = mysql_query($read_sql, $link) or die(could not read the table); echo Result of read ; echo $result; echo Error Results ; echo mysql_errno ($link); $number_of_rows = mysql_num_rows($result); echo Number or Rows ; echo $number_of_rows; //if return no rows then we need to add the record if ($number_of_rows == 0){ $insert_sql = INSERT INTO TBL_Picture VALUES (\; $insert_sql .= $fn_FileName; $insert_sql .= \,\; $insert_sql .= $fn_Path; $insert_sql .= \,\; $insert_sql .= $fn_Year; $insert_sql .= \,\; $insert_sql .= $fn_DescriptiveText; $insert_sql .= \,\; $insert_sql .= $fn_PictureName; $insert_sql .= \); echo Insert Sql ; echo $insert_sql; $result2 = mysql_query($insert_sql, $link); // or die(could not write to the table ); echo Error Results ; echo mysql_error ($link); echo Result is of 2 is; echo $result2; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: [PHP] trouble reading a database (fwd)
-- Forwarded message -- Date: Mon, 23 Apr 2001 20:19:57 -0500 (CDT) From: johndmiller [EMAIL PROTECTED] To: Jason Murray [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] trouble reading a database (fwd) Thanks for the pointer about ' vs . I have changed my code to used these. The code is a lot cleaner. I am still getting a not found error. Below is the new cleaner messages that I display. One point that may be important, FLD_Name and FLD_Path are the primary key. Couple of questions, can I recreate the same key and use just one name (looks like I could) and would this help with the problem. Read_sql SELECT * FROM TBL_Picture WHERE FLD_FileName = 'IceCastle.jpg' and FLD_Path = '/var/www/html/slidecollection/WinterCarnival' Error Results Result of read Resource id #2 Number or Rows 0 Insert Sql INSERT INTO TBL_Picture VALUES ('IceCastle.jpg', '/var/www/html/slidecollection/WinterCarnival', '1984', 'This is a picture of an Ice Castle at night.', 'Ice Castle') Error Results Duplicate entry '/var/www/html/slidecollection/WinterCarnival-IceCastle.jpg' for key 1 Can I set up my primary key On Tue, 24 Apr 2001, Jason Murray wrote: Read_sql SELECT * FROM TBL_Picture WHERE FLD_FileName = SailBoat.jpgand FLD_Path = /var/www/html/slidecollection/WinterCarnival This is a little hideous. For one thing, you should probably use ' and not . It may not make a difference to MySQL, but it does to other databases you may use in the future. For the FLD_Path comparison, you are looking for something that specifically STARTS with a space. I'd bet this is why the script is getting 0 rows back - probably none of your FLD_Path's start with a space. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] db read
I am new a database stuff. I am using mysql 4.0.1 with php on RH7.0. I am setting up a db with three fields with no-one field being unique. Do I have to have a unique field? The purpose of this db is to store a word, name of a file, and path to the file. My plan is to use a where clause, but I am not sure if it would be more efficent to do WHERE field1=word and field2=filename and field3=path; or WHERE field1 = word and then read through the rows using something like a for each and check the other two fields. Thank in Advance John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] trouble reading a database
Below is the output and code for my problem. When the database gets read, it returns 0 rows. When it writes, it says it can't because of duplicate entry. FLD_FileName and FDL_Path are the Primary key. Two questions, what I am doing wrong and is there a better way to create a string of text then the one used below. TIA John Read_sql SELECT * FROM TBL_Picture WHERE FLD_FileName = "SailBoat.jpg"and FLD_Path =" /var/www/html/slidecollection/WinterCarnival" Result of read Resource id #2 Error Results 0 Number or Rows 0 Insert Sql INSERT INTO TBL_Picture VALUES ("SailBoat.jpg","/var/www/html/slidecollection/WinterCarnival", "1234","gfgfdgfddg","gfdgfd") Error Results Duplicate entry '/var/www/html/slidecollection/WinterCarnival-SailBoat.jpg' for key 1Result is of 2 is //reading the database to see if record already exists $result = mysql_select_db ("Picture_DB", $link) or die ("Could not get the database"); $read_sql = "SELECT * FROM TBL_Picture WHERE FLD_FileName = \""; $read_sql .= $fn_FileName; $read_sql .= "\"and FLD_Path =\" "; $read_sql .= $fn_Path; $read_sql .= "\""; echo " Read_sql "; echo $read_sql; $result = mysql_query($read_sql, $link) or die("could not read the table"); echo "Result of read "; echo $result; echo " Error Results "; echo mysql_errno ($link); $number_of_rows = mysql_num_rows($result); echo " Number or Rows "; echo $number_of_rows; //if return no rows then we need to add the record if ($number_of_rows == 0){ $insert_sql = "INSERT INTO TBL_Picture VALUES (\""; $insert_sql .= $fn_FileName; $insert_sql .= "\",\""; $insert_sql .= $fn_Path; $insert_sql .= "\",\""; $insert_sql .= $fn_Year; $insert_sql .= "\",\""; $insert_sql .= $fn_DescriptiveText; $insert_sql .= "\",\""; $insert_sql .= $fn_PictureName; $insert_sql .= "\")"; echo " Insert Sql "; echo $insert_sql; $result2 = mysql_query($insert_sql, $link); // or die("could not write to the table "); echo " Error Results "; echo mysql_error ($link); echo "Result is of 2 is"; echo $result2; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] can't connect to mysql
I just looked at my mysql.sock file and it has a length of zero. Is this the right size, I don't think it is. If not, do I have to reinstall MySQL to get the file back or can I get it from somewhere else. FYI: running RH7.0, Apache Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySql won't connect
I know that the pages that I am using worked. I created them, then had to reload my OS. I saved everything before erasing the HD. I have restored the files but now I get a warning message that says MySQL Connection Failed: Can't connect to local MySQL server through socket The mysql.sock does exist, there is also a pid file there pointing to the current running occurance of MySQL. I have root set up with a password and I am able to connect to MySQL from a promopt. Below is the offending code. I think there is something that I missed when I set things up. FYI: I am running RH7.0 and Apache you are welcome to check out this page: http://24.163.168.40/phpinfo.php $link = mysql_connect("localhost", "root", "secret") or die("can't connect"); Last, I did look for the php-mysql module and it is on the system. Thanks John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]