lalnfl Posted October 24, 2010 Share Posted October 24, 2010 When I do this: $matches++; $sql_update_matches = mysql_query("UPDATE Live_Event SET matches='$matches' WHERE id='$show_id' AND promo_id='$promotion_id'"); But when it should update the database from 0 to 1, it update it to U. What is the problem? Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/ Share on other sites More sharing options...
tastro Posted October 24, 2010 Share Posted October 24, 2010 define your variables please. Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125981 Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2010 Share Posted October 24, 2010 Where are you setting or getting $matches from? You are likely setting it to 'T' or 'TRUE', probably by a comparison that is actually an assignment statement (i.e. one = sign instead of two.) Also, you don't need to SELECT a value in order to UPDATE it, just increment the value IN the UPDATE query. Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125983 Share on other sites More sharing options...
lalnfl Posted October 24, 2010 Author Share Posted October 24, 2010 $sql_show_name = mysql_query("SELECT * FROM Live_Event WHERE id='$show_id' AND promo_id='$promotion_id'"); $show_name = mysql_fetch_array($sql_show_name); $show_name = $show_name['name']; $matches = $show_name['matches']; Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125984 Share on other sites More sharing options...
lalnfl Posted October 24, 2010 Author Share Posted October 24, 2010 Does anyone know what the T and U mean in the database? I shouldn't be getting them, but yet I am. Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125986 Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2010 Share Posted October 24, 2010 They mean nothing. It is your data and your code. You are either setting them to those values (an 'T' + 1 is a 'U') or you are treating the number as an ascii character and it has been incremented to the value of a U/T. Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125987 Share on other sites More sharing options...
lalnfl Posted October 24, 2010 Author Share Posted October 24, 2010 So how would I get my value to go back to numbers? Because its doing the (an 'T' + 1 is a 'U') thing? How do I get it back to incrementing numbers? Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125992 Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2010 Share Posted October 24, 2010 You have posted a grand total of 6 lines of code out of your whole program. How would anyone here know how your code created the problem or what to fix in it to prevent it. Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125994 Share on other sites More sharing options...
lalnfl Posted October 24, 2010 Author Share Posted October 24, 2010 You have posted a grand total of 6 lines of code out of your whole program. How would anyone here know how your code created the problem or what to fix in it to prevent it. Don't get worked up about this, it was just a question. Anyways, I solved the problem. Link to comment https://forums.phpfreaks.com/topic/216733-phpdatabase-help/#findComment-1125996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.