[PHP-DB] PHP/MySQL and passing url params
Hi All, I am new to the list, as a matter of fact this is my first post so if I'm covering territory that has been already covered please excuse me. I am using PHP/MySQL/Dreamweaver MX. I expect the razzing to start anytime now.;-) I am also very new to php. I have a form that is gathering user information and inserting it into the database. From there it is going to a "Thank You" page that shows their first name, username and password. The username and password are generated after they enter their information in the aforementioned form and then is displayed on the Thank You page. The problem I'm having is that when I put a url parameter on the go to page I get these errors; Notice: Undefined variable: row_rsID in D:\web\demo\login\TMP97xok4jxov.php on line 48 Warning: Cannot add header information - headers already sent by (output started at D:\web\demo\login\TMP97xok4jxov.php:48) in D:\web\demo\login\TMP97xok4jxov.php on line 53 When I define the variable $row_rsID = ""; I get; Notice: Uninitialized string offset: 0 in D:\web\hogana\demo\login\TMP9ee7s4jxx8.php on line 48 Warning: Cannot add header information - headers already sent by (output started at D:\web\hogana\demo\login\TMP9ee7s4jxx8.php:48) in D:\web\hogana\demo\login\TMP9ee7s4jxx8.php on line 53 And my insert behavior disappears. Can someone shed some light on this? If I'm missing a step or there is a better way to do this please let me know. I've been trying to find a way to redirect in php but have come up empty there. Is there a way to redirect without mixing languages? If I try to remove this I can't identify the user when I go to the Thank You page, I keep getting the first recordset. Oddly enough the functions I wrote that generate the username and the password work great! Isn't that always the case. TIA, alex -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP/MySQL and passing url params
Sorry..., my bad. Too wrapped up in the problem. Notice: Undefined variable: row_rsID in D:\web\hogana\demo\login\TMPbl2tw4o24u.php on line 48 Warning: Cannot add header information - headers already sent by (output started at D:\web\hogana\demo\login\TMPbl2tw4o24u.php:48) in D:\web\hogana\demo\login\TMPbl2tw4o24u.php on line 53 User Registration Enter Registration Information You must fill in all the required fields. First Name: Last Name: Address: City: State: Zip: Phone: UserName: eMail Address: -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP/MySQL and passing url params
How do I set $row_rsID['userID']? Do I use (isset($row_rsID['userID']); or something similar? Would I define an array, $my_array[]; and then look to populate the array dynamically? $my_array[0] = "something"; $my_array[1] = "something else"; I've probably missed something in the docs but I don't seem to find any hard fast rules on defining arrays or rediminsioning them. alex > -Original Message- > From: Peter Beckman [mailto:beckman@;purplecow.com] > Sent: Sunday, October 27, 2002 9:29 PM > To: alex hogan > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP-DB] PHP/MySQL and passing url params > > The first question is is $row_rsID actually an array when you run the > script? > > If it is, is $row_rsID['userID'] set? > > If it isn't, is $row_rsID['userid'] set? > > If you want to set the variable $row_rsID statically do this: > > $row_rsID = array("userID"=>1); > > Where does $row_rsID get set? Does it set $row_rsID['userID']? > > Peter > > On Sun, 27 Oct 2002, alex hogan wrote: > > > Sorry..., my bad. Too wrapped up in the problem. > > > > > > > > Notice: Undefined variable: row_rsID in > > D:\web\hogana\demo\login\TMPbl2tw4o24u.php on line 48 > > > > Warning: Cannot add header information - headers already sent by (output > > started at D:\web\hogana\demo\login\TMPbl2tw4o24u.php:48) in > > D:\web\hogana\demo\login\TMPbl2tw4o24u.php on line 53 > > > > > > > function GetSQLValueString($theValue, $theType, $theDefinedValue = "", > > $theNotDefinedValue = "") > > { > > $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : > > $theValue; > > > > switch ($theType) { > > case "text": > > $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; > > break; > > case "long": > > case "int": > > $theValue = ($theValue != "") ? intval($theValue) : "NULL"; > > break; > > case "double": > > $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : > > "NULL"; > > break; > > case "date": > > $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; > > break; > > case "defined": > > $theValue = ($theValue != "") ? $theDefinedValue : > > $theNotDefinedValue; > > break; > > } > > return $theValue; > > } > > > > $editFormAction = $HTTP_SERVER_VARS['PHP_SELF']; > > if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { > > $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; > > } > > > > if ((isset($HTTP_POST_VARS["MM_insert"])) && > > ($HTTP_POST_VARS["MM_insert"] == "frmReg")) { > > $insertSQL = sprintf("INSERT INTO user (username, fname, lname, > > address, city, `state`, zip, phone, email) VALUES (%s, %s, %s, %s, %s, > > %s, %s, %s, %s)", > > GetSQLValueString($HTTP_POST_VARS['txtUserName'], > > "text"), > > GetSQLValueString($HTTP_POST_VARS['txtFName'], > > "text"), > > GetSQLValueString($HTTP_POST_VARS['txtLName'], > > "text"), > > GetSQLValueString($HTTP_POST_VARS['txtAddress'], > > "text"), > >GetSQLValueString($HTTP_POST_VARS['txtCity'], > > "text"), > > GetSQLValueString($HTTP_POST_VARS['txtState'], > > "text"), > >GetSQLValueString($HTTP_POST_VARS['txtZip'], > > "text"), > > GetSQLValueString($HTTP_POST_VARS['txtPhone'], > > "text"), > > GetSQLValueString($HTTP_POST_VARS['txtEmail'], > > "text")); > > > > mysql_select_db($database_connHoganMain, $connHoganMain); > > $Result1 = mysql_query($insertSQL, $connHoganMain) or > > die(mysql_error()); > > > > //Line 48 below - > > > > $insertGoTo = "thanks.php?id=" . $row_rsID['userID'] . ""; > > if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { > > $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; > > $in
RE: [PHP-DB] PHP/MySQL and passing url params
> Why'd you use it in the first place? Where does $row_rsID['userID'] get > set? Why is it in your script if you don't know where it is set and what > it is set to? It was generated by Dreamweaver, had it not been automatically generated code we wouldn't be having this conversation. See, I'm not in the habit of coding something that I don't know all the particulars of. I'm funny that way. Like I stated in a previous post I know I'm going to get razzed for using Dreamweaver, so I guess I'll just have to take my lumps and get over it. However, $row_rsID['userID'] is what should be the retrieval of the value of the field 'userID', from the connection rsID. The $row_rsID should have a value of the query of the database for the userID, (a unique value) that corresponds to the input values that the form is sending to the database. If I'm not mistaken it is being set with; $query_rsID = "SELECT * FROM `user`"; $rsID = mysql_query($query_rsID, $connHoganMain) or die(mysql_error()); $row_rsID = mysql_fetch_assoc($rsID); $totalRows_rsID = mysql_num_rows($rsID); I'm guessing that since I didn't declare 'userID' in the switch statement it isn't being recognized as an appropriate index. Thanks for the breakout on the arrays. alex > -Original Message- > From: Peter Beckman [mailto:beckman@;purplecow.com] > Sent: Monday, October 28, 2002 10:20 AM > To: alex hogan > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP-DB] PHP/MySQL and passing url params > > Why'd you use it in the first place? Where does $row_rsID['userID'] get > set? Why is it in your script if you don't know where it is set and what > it is set to? > > You set it like this: > > $row_rsID['userID'] = "whatever you want here, probably an int like '0'"; > > Several ways to define arrays: > > $array = array(); // set empty array > > $hash = array("stuff"=>"foo"); // a hash effectively > > $array = array(); > array_push($array, "stuff to push onto the array"); > > $array[] = "foo"; // same as "array_push" > > $array[37] = "foo"; // set array index 37 to foo. > > $array['stuff'] = "foo"; // set "hash" (array using words) stuff to foo > > $array[0][0][stuff] = "foo"; //multidimensional array. > > $array[0][1][stuff] = array("stuff"=>"foo"); > > Peter > > On Mon, 28 Oct 2002, alex hogan wrote: > > > How do I set $row_rsID['userID']? > > > > Do I use (isset($row_rsID['userID']); or something similar? > > > > Would I define an array, $my_array[]; and then look to populate the > > array dynamically? > > $my_array[0] = "something"; > > $my_array[1] = "something else"; > > > > I've probably missed something in the docs but I don't seem to find any > > hard fast rules on defining arrays or rediminsioning them. > > > > alex > > > > > -Original Message- > > > From: Peter Beckman [mailto:beckman@;purplecow.com] > > > Sent: Sunday, October 27, 2002 9:29 PM > > > To: alex hogan > > > Cc: [EMAIL PROTECTED] > > > Subject: RE: [PHP-DB] PHP/MySQL and passing url params > > > > > > The first question is is $row_rsID actually an array when you run the > > > script? > > > > > > If it is, is $row_rsID['userID'] set? > > > > > > If it isn't, is $row_rsID['userid'] set? > > > > > > If you want to set the variable $row_rsID statically do this: > > > > > > $row_rsID = array("userID"=>1); > > > > > > Where does $row_rsID get set? Does it set $row_rsID['userID']? > > > > > > Peter > > > > > > On Sun, 27 Oct 2002, alex hogan wrote: > > > > > > > Sorry..., my bad. Too wrapped up in the problem. > > > > > > > > > > > > > > > > Notice: Undefined variable: row_rsID in > > > > D:\web\hogana\demo\login\TMPbl2tw4o24u.php on line 48 > > > > > > > > Warning: Cannot add header information - headers already sent by > > (output > > > > started at D:\web\hogana\demo\login\TMPbl2tw4o24u.php:48) in > > > > D:\web\hogana\demo\login\TMPbl2tw4o24u.php on line 53 > > > > > > > > > > > > > > > function GetSQLValueString($theValue, $theType, $theDefinedValue = > > "", >
RE: [PHP-DB] PHP/MySQL and passing url params
I am using PHAKT's PHP model. > -Original Message- > From: dwalker [mailto:dwalker@;healthyproductsplus.com] > Sent: Monday, October 28, 2002 8:43 PM > To: alex hogan; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] PHP/MySQL and passing url params > > Are you working with the PHP model that came with MX or are you working with > PHAKT's PHP model for UD > -----Original Message- > From: alex hogan <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> > Date: Sunday, October 27, 2002 6:43 PM > Subject: [PHP-DB] PHP/MySQL and passing url params > > > >Hi All, > > > >I am new to the list, as a matter of fact this is my first post so if > >I'm covering territory that has been already covered please excuse me. > > > >I am using PHP/MySQL/Dreamweaver MX. I expect the razzing to start > >anytime now.;-) I am also very new to php. > > > >I have a form that is gathering user information and inserting it into > >the database. From there it is going to a "Thank You" page that shows > >their first name, username and password. > > > >The username and password are generated after they enter their > >information in the aforementioned form and then is displayed on the > >Thank You page. > > > >The problem I'm having is that when I put a url parameter on the go to > >page I get these errors; > >Notice: Undefined variable: row_rsID in > >D:\web\demo\login\TMP97xok4jxov.php on line 48 > > > >Warning: Cannot add header information - headers already sent by (output > >started at D:\web\demo\login\TMP97xok4jxov.php:48) in > >D:\web\demo\login\TMP97xok4jxov.php on line 53 > > > >When I define the variable $row_rsID = ""; > > > >I get; > >Notice: Uninitialized string offset: 0 in > >D:\web\hogana\demo\login\TMP9ee7s4jxx8.php on line 48 > > > >Warning: Cannot add header information - headers already sent by (output > >started at D:\web\hogana\demo\login\TMP9ee7s4jxx8.php:48) in > >D:\web\hogana\demo\login\TMP9ee7s4jxx8.php on line 53 > > > >And my insert behavior disappears. > > > >Can someone shed some light on this? If I'm missing a step or there is > >a better way to do this please let me know. I've been trying to find a > >way to redirect in php but have come up empty there. Is there a way to > >redirect without mixing languages? > > > >If I try to remove this I can't identify the user when I go to the Thank > >You page, I keep getting the first recordset. Oddly enough the > >functions I wrote that generate the username and the password work > >great! Isn't that always the case. > > > > > >TIA, > > > >alex > > > > > > > >-- > >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] airport codes db
You know that is an excellent idea. alex > -Original Message- > From: [EMAIL PROTECTED] [mailto:bbonkosk@;tampabay.rr.com] > Sent: Wednesday, November 13, 2002 6:38 AM > To: Edward Peloke; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] airport codes db > > You should take advantage of this highly international PHP communicty and set > up a simple PHP interface to a table like: > Airport Code | Airport City | Airport Name | Country | etc.. > > And then ask people to go in there and insert whatever information they know > especially from around their area. Then you could post the rresulting mysql > database somewhere for people's future use? > > > I am working on a php page where I need some airport codes data, I have seen > > a few places online where you can buy this data so I was wondering if anyone > > has used any of these databases and if anyone had a good source for a mysql > > airport code db. > > > > Thanks, > > Eddie > > > > > > -- > > 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] phpmysqladmin
Matt, The url is; www.phpmyadmin.net You are right, it is a web interface for MySQL. alex > -Original Message- > From: Matt Giddings [mailto:cen10761@;centurytel.net] > Sent: Friday, November 15, 2002 11:18 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] phpmysqladmin > > Anybody have the url for phpmysqladmin? I believe phpmysqladmin is a > web interface for mysql. I'm sure someone will correct me if I'm wrong. > : ) > > Thanks, > Matt > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.399 / Virus Database: 226 - Release Date: 10/9/2002 > > > > -- > 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