This is a dedicated thread for discussing the SitePoint article ‘Give me back my MySQL Command Line!’
I tried to use this code, but it didn’t work. I submitted a query and all that happened was the page reset back to default settings. I logged into my DB and hit the up arrow to look at recent queries and it appears that the code is working, the queries get to the DB, but nothing gets retreived and displayed??
In this article, Kevin uses mysql_db_query(), however, that function has been depricated since PHP 4.0.6, and mysql_select_db() should be used instead.
I’ve just updated the article to work with magic_quotes_gpc Off (which will solve the Anonymous problem above) and to not use mysql_db_query().
Enjoy!
hi
i’m using this script and when i came back right now, i saw the updated notice but just cant download the full script from http://www.sitepoint.com/examples/mysqlcmdln/mysqlcmdln.php.txt
…
hi again
i use this script many times, and several times i use the same sql statements. Can anyone give me a few clues on how i can expand it to save the sql statements i write to query the database, so was easier to work with when i want to have it written? (kind of a select button or radio button or like…that pastes the saved sql directly to the textarea)
thanks
hi
i designed the same script with the reference from some book but i was getting error then i manipulated my script using this script and got successfull. but i have a problem
in this we used $_POST[‘query’] . if i am assigning a variable for this like
$query=$_POST[‘query’]
and using assigned variable in place of writing $_POST[‘query’] then i am getting error. please tell me what is the difference between both the methods. why i cant use the second way
There should be no difference. The error must be caused by something else.
This wasn’t parsing the table data (<td>) right for me. I had to change the following at line 37 of mysqlcmdln.php.txt:
===snip===
echo(‘<td>’.$row[$i].‘</tr>’);
===snip===
I had to change it to:
===snip===
echo(‘<td>’.$row[$i].‘</td>’);
===snip===
Fixed, thanks michael!
I found this and have used it because I needed to access a database to which the host has moved the position of phpmyadmin.
Anyway I needed to insert lots of data.
Doing it one line at a time works fine, but if i enter more than one line it fails with an error in your syntax.
Any idea why this is?
These two lines entered seperately worked fine, entered as one entity it throws the error.
INSERT INTO `address_format` VALUES (4, '$firstname $lastname$cr$streets$cr$city ($postcode)$cr$country', '$postcode / $country');
INSERT INTO `address_format` VALUES (5, '$firstname $lastname$cr$streets$cr$postcode $city$cr$country', '$city / $country');
Hi can you upload the code full code please i got so many errors. my e-mail: thimcederlund@hotmail.com
If I have phpmyAdmin, why would I need this function?
In any case, seeing how this code develops in php was useful to me.
I can’t either, it gave me a security warning, and now it just redirects to sitepoint. Can you email it to me please!