[PHP] PhP/MySQL Search Results code
Newbie question - please excuse. I'm using Dreamweaver to generate most of my PhP. I have created a search page and am trying to generate the results page. The search form is using the GET function and the form field name is manufacturer. The following code is generated by DW in the results page... ?php $vManufacturer_rs_RobesonResultsList = Reece; if (isset(manufacturer)) { $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); } mysql_select_db($database_VandyDivAddresses, $VandyDivAddresses); $query_rs_RobesonResultsList = sprintf(SELECT robeson_inv.manufacturer, robeson_inv.model, robeson_inv.specs, robeson_inv.qty FROM robeson_inv WHERE robeson_inv.manufacturer = '%s' ORDER BY robeson_inv.model, $vManufacturer_rs_RobesonResultsList); $rs_RobesonResultsList = mysql_query($query_rs_RobesonResultsList, $VandyDivAddresses) or die(mysql_error()); $row_rs_RobesonResultsList = mysql_fetch_assoc($rs_RobesonResultsList); $totalRows_rs_RobesonResultsList = mysql_num_rows($rs_RobesonResultsList); ? I'm always getting an error when testing the page. The error is... Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4 The line to which it refers is the line stating, $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); Anyone know what the problem may be? Thanx in advance for any help provided, Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PhP/MySQL Search Results code
[snip] if (isset(manufacturer)) { $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); } Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4 [/snip] Looks like 'manufacturer' needs a $ in fromt of it to make it a variable if (isset($manufacturer)) { $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? $manufacturer : addslashes($manufacturer); } HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP/MySQL Search Results code
The line should be $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? $manufacturer : addslashes($manufacturer); Robb Kerr wrote: Newbie question - please excuse. I'm using Dreamweaver to generate most of my PhP. I have created a search page and am trying to generate the results page. The search form is using the GET function and the form field name is manufacturer. The following code is generated by DW in the results page... ?php $vManufacturer_rs_RobesonResultsList = Reece; if (isset(manufacturer)) { $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); } mysql_select_db($database_VandyDivAddresses, $VandyDivAddresses); $query_rs_RobesonResultsList = sprintf(SELECT robeson_inv.manufacturer, robeson_inv.model, robeson_inv.specs, robeson_inv.qty FROM robeson_inv WHERE robeson_inv.manufacturer = '%s' ORDER BY robeson_inv.model, $vManufacturer_rs_RobesonResultsList); $rs_RobesonResultsList = mysql_query($query_rs_RobesonResultsList, $VandyDivAddresses) or die(mysql_error()); $row_rs_RobesonResultsList = mysql_fetch_assoc($rs_RobesonResultsList); $totalRows_rs_RobesonResultsList = mysql_num_rows($rs_RobesonResultsList); ? I'm always getting an error when testing the page. The error is... Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4 The line to which it refers is the line stating, $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); Anyone know what the problem may be? Thanx in advance for any help provided, Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP/MySQL Search Results code
That was it! Thanx for the help. This board has proven invaluable to me. Robb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP/MySQL Search Results code
* Thus wrote Robb Kerr ([EMAIL PROTECTED]): I'm always getting an error when testing the page. The error is... Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4 The line to which it refers is the line stating, $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); hmm.. what part of line 4? take the php line and put it on 4 different lines $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer); What line is the error on now? line 6? ah.. so what exacly is manufacturer? A variable, constant, string or number? I'm going to make the assumption that it is a variable. So you need to prepend a $ to the word manufacturer ($manufacturer). If you test it now, you'll probaly get a notice/warning about line 7 (depending on php's error_reporting level). You'll probably want to make that manufacturer a variable also. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php