atl_andy Posted April 18, 2008 Share Posted April 18, 2008 I have a table with several records the have a # in their fields. e.g., PU923AW#ABA. I use a select statement that matches based on that value, and it pulls two other fields with it to display on a form. The problem is when that record is chosen, it only pulls one field and not the others. Do # have to be escaped when they are inserted into a mysql db? ------------------------------------------- Part Number | MFR | Model/Description | ------------------------------------------- PB-G4PM1.7 | APPLE | POWER BOOK G4 | This will pull the Part Number, MFR and Model ok ------------------------------------------- PU923AW#ABA | HP | NC6220 | This will only pull the Part Number, and the MFR and Model fields are blank, which makes ------------------------------------------- me think the problem is with the # in the part number. The select statement being used: $selected = $_GET['partnumber']; $result = mysql_query("SELECT * FROM partnumber WHERE partnumber = ' ".$selected." '; Link to comment https://forums.phpfreaks.com/topic/101745-how-is-the-handled-in-mysql/ Share on other sites More sharing options...
Barand Posted April 18, 2008 Share Posted April 18, 2008 # in a querystring will give you problems as it used to go to a named anchor point on a page. <?php $partno = 'PU923AW#ABA'; echo "<a href='mypage.php?part=$partno'>click</a>"; // got problems!!! $p = urlencode($partno); echo "<a href='mypage.php?part=$p'>click</a>"; // should be OK ?> Link to comment https://forums.phpfreaks.com/topic/101745-how-is-the-handled-in-mysql/#findComment-520619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.