kalivos Posted August 9, 2006 Share Posted August 9, 2006 I have a column in my database named "alt" defined as "text". When I perform a SELECT query from that row, it pulls until a "-" is found. It displays random segments from that pull.Example data in db: ...through the Sierra Nevada Mountains-what happened at this year's race?Data displayed:what happened at this year's race?I know that ' or " can cause wierd things like this to happen, but - ? Anyone seen this before? Quote Link to comment Share on other sites More sharing options...
SharkBait Posted August 9, 2006 Share Posted August 9, 2006 What does your query look like? Quote Link to comment Share on other sites More sharing options...
kalivos Posted August 9, 2006 Author Share Posted August 9, 2006 [code]$conn->query("SELECT * FROM ads WHERE type='$type' AND start < '$start_date' AND (end > '$end_date' OR end = '')"); while($my_row=$conn->get_row()){ $this->id[] = stripslashes($my_row['ID']); $this->link[] = stripslashes($my_row['out_id']); $this->alt[] = stripslashes($my_row['alt']); $this->img[] = stripslashes($my_row['img']); $this->title[] = stripslashes($my_row['title']); }[/code]I then display the arrays with a loop. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted August 9, 2006 Share Posted August 9, 2006 What if you change your query a bit to look like this:[code]SELECT * FROM ads WHERE type = '{$type}' AND start < '{$start_date}' AND (end > '{$end_date} OR end = '')[/code]Adding in the curly braces around the varibles. SQL might be seeing the - as a minus operator in the query. Which doesn't make sense to me while I type this out but worth a shot.What if you just try to output the info without putting into your class?[code]<?php$qry = "SELECT * Blahblahblah WHERE blah = blah";$query = mysql_query($qry) or die("Error: ". mysql_error());while($my_row = mysql_fetch_array($query, MYSQL_ASSOC)) { echo "{$my_row['ID']} <br /> {$my_row['out_id']}<br /> {$my_row['alt']}</br /> {$my_row['img']}<br /> {$my_row['title']}<br />";}?>[/code] Quote Link to comment Share on other sites More sharing options...
kalivos Posted August 9, 2006 Author Share Posted August 9, 2006 After outputing the data and realizing that it WAS working correctly, I looked at the rest of my code. I was useing "-" as a seperator and thus exploding() to find my data :-/Thanks for the help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.