5kyy8lu3 Posted January 13, 2009 Share Posted January 13, 2009 i added two new columns to my table and i made an IF statement that runs a function to get data to put into the empty columns. i keep getting two errors though. here are the errors: Warning: Unexpected character in input: '' (ASCII=31) state=1 in /hermes/bosweb/web191/b1913/ipw.kloudzco/public_html/ipbreakdown.php on line 87 Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web191/b1913/ipw.kloudzco/public_html/ipbreakdown.php on line 87 here's the weird thing, i echo my query just to make sure i formatted it correctly, and here's what it echo's: UPDATE visitorlog SET cc='us', ccn='United States' WHERE ipaddy='74.127.83.146' that looks right to me, the table name is right, the columns are right, and the syntax is right as far as i know i copied that query, and pasted it into my MySQL Query Sender page I made, and it executes it just fine, but my page's mysqli_query won't work with that query. any ideas? here's the code: (i already included the file that contains that function 'iptoc' just before this code) if ( $row2['cc'] == '' ) { $cc = iptoc($row3['ipaddy']); $cc2 = ucwords(strtolower($cc[2])); $cc3 = strtolower($cc[0]); $q_x = "UPDATE visitorlog SET cc='" . $cc3 . "', ccn='" . $cc2 . "' WHERE ipaddy='" . $row3['ipaddy'] . "'"; $r_x = mysqli_query($cxn, $q_x); } if i comment out the last line and echo the query, i get the query i pasted earlier. this is bugging the crap out of me so any help would be great, thanks ahead of time =) Link to comment https://forums.phpfreaks.com/topic/140623-solved-need-fresh-eyes/ Share on other sites More sharing options...
DarkWater Posted January 13, 2009 Share Posted January 13, 2009 Somehow, you have a hidden 0x31 in between mysqli and _query. PHP is reading it as: mysqli0x31_query I noticed it because when I pasted it into bash, I got: [email protected]:~$ php -l <?php if ( $row2['cc'] == '' ) { $cc = iptoc($row3['ipaddy']); $cc2 = ucwords(strtolower($cc[2])); $cc3 = strtolower($cc[0]); $q_x = "UPDATE visitorlog SET cc='" . $cc3 . "', ccn='" . $cc2 . "' WHERE ipaddy='" . $row3['ipaddy'] . "'"; $r_x = mysqli^__query($cxn, $q_x); } Warning: Unexpected character in input: '' (ASCII=31) state=0 in - on line 8 Parse error: syntax error, unexpected T_STRING in - on line 8 Check out the $r_x line. Link to comment https://forums.phpfreaks.com/topic/140623-solved-need-fresh-eyes/#findComment-735914 Share on other sites More sharing options...
5kyy8lu3 Posted January 13, 2009 Author Share Posted January 13, 2009 Somehow, you have a hidden 0x31 in between mysqli and _query. PHP is reading it as: mysqli0x31_query I noticed it because when I pasted it into bash, I got: [email protected]:~$ php -l <?php if ( $row2['cc'] == '' ) { $cc = iptoc($row3['ipaddy']); $cc2 = ucwords(strtolower($cc[2])); $cc3 = strtolower($cc[0]); $q_x = "UPDATE visitorlog SET cc='" . $cc3 . "', ccn='" . $cc2 . "' WHERE ipaddy='" . $row3['ipaddy'] . "'"; $r_x = mysqli^__query($cxn, $q_x); } Warning: Unexpected character in input: '' (ASCII=31) state=0 in - on line 8 Parse error: syntax error, unexpected T_STRING in - on line 8 Check out the $r_x line. weird! notepad keeps corrupting my stuff, i guess it's time to upgrade to a different editing solution thanks for the help, i appreciate it Link to comment https://forums.phpfreaks.com/topic/140623-solved-need-fresh-eyes/#findComment-735926 Share on other sites More sharing options...
DarkWater Posted January 13, 2009 Share Posted January 13, 2009 I'd suggest something simple like Notepad++. Link to comment https://forums.phpfreaks.com/topic/140623-solved-need-fresh-eyes/#findComment-735929 Share on other sites More sharing options...
xtopolis Posted January 13, 2009 Share Posted January 13, 2009 Or Notepad2 depending on your fancy. edit: might have to check out N++, it has plugins.. ooo aahhh Link to comment https://forums.phpfreaks.com/topic/140623-solved-need-fresh-eyes/#findComment-735930 Share on other sites More sharing options...
5kyy8lu3 Posted January 13, 2009 Author Share Posted January 13, 2009 woot the code worked! i was optimizing my page. it accessed two functions, one to get country code, country name, and another function that sniffs the browser agent string for specific browsers, and this happened for every single row in the table i was printing out, and it ran SLOW lol. now with the output of the functions in the new columns, it runs very fast once again, woot. really appreciate your help, and i'll look into those notepad-esque variations Link to comment https://forums.phpfreaks.com/topic/140623-solved-need-fresh-eyes/#findComment-735946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.