|
-
Aug 20th, 2005, 09:04 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] sql or php problem?????
okay i have a script im making for when i dont wana get into PHPmyAdmin.
heres the code
PHP Code:
if(isset($_POST['add_query_command']))
{
$result = mysql_query( $_POST['sql_info'])
or die(mysql_error());
switch(mysql_errno()) {
case 1050:
break;
case 0:
echo"Query Sucessfull";
break;
default:
die(mysql_error());
break;
}
}
elseif(isset($_GET['sql_help']))
{
echo"The Help File is being thought up and written as you read.";
}
else
{
echo"<form name=sqlinfo method=post action=$PHP_SELF>
Write your SQL statements/queries in the textarea below:
<table width=38% border=0 cellspacing=0 cellpadding=0>
<tr>
<th scope=row>
<div align=center>
<textarea name=sql_info cols=70 rows=30></textarea>
<input name=add_query_command type=submit value=Insert>
<input name=clearsql type=reset id=clearsql value=Clear>
<a href='$PHP_SELF?sql_help'>SQL HELP</a>
</div>
</th>
</tr>
</table>
</form>
";
}
I get no errors until i try and submit... and its not a bad code error... its a mysql error...
how can i fix it so that it works... if i cant get this to work... ill just go back to making a php file and hardcoding the "CREATE" and "INSERT" values in.
BTW: I didnt include the mysql_connect() stuff..
Last edited by PlaGuE; Aug 20th, 2005 at 09:20 PM.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Aug 21st, 2005, 04:11 AM
#2
Thread Starter
Hyperactive Member
Re: sql or php problem?????
BUMP... oops did i do that.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Aug 21st, 2005, 11:57 PM
#3
Thread Starter
Hyperactive Member
Re: sql or php problem?????
anyone know what could be the problem?
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Aug 22nd, 2005, 12:09 AM
#4
Lively Member
Re: sql or php problem?????
I copy and pasted your exact code,and it seems to be working for me, assuming I'm typing in the same values you are. Can you give an example of the query you're typing in thats erroring out.
-
Aug 22nd, 2005, 01:16 AM
#5
Thread Starter
Hyperactive Member
Re: sql or php problem?????
i fixed it with a $result = mysql_query(stripslashes( $_POST['sql_info'])) or die(mysl_error());
hmm even the simplest query wouldnt work... with the posted code... IE CREATE TABLE dumb (id mediumin(11))
then i stuck strip slashes in.. and it worked... wierd...
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|