Webdetector Webmaster Forums - Your favorite webmaster community
 
  #1 (permalink)  
Old 06-17-2008, 04:42 AM
Member
noobee
 
Join Date: Jun 2008
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with SQl.....?

Code:
<?php

require 'config.php';
$username=$_POST['username'];
$offence=$_POST['offence'];
$punishment= $_POST['punishment'];

mysql_connect ($dbhost,$dbusername,$dbpassword); //used to conneect to the mysql database
mysql_select_db("naughtylist") or die (mysql_error());
SELECT count (*)FROM information_schema.tables;
WHERE table_schema=<naughtylist> AND table_name=<naughty>
mysql_query ("INSERT INTO naughty (username, offence, punishment) VALUES ('$username','$offence', '$punishment')");

?>

That is what I have so far...

SELECT count (*)FROM information_schema.tables;

returns an error:

Parse error: syntax error, unexpected T_STRING
I created the DB and table using Mysql migration toolkit.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)  
Old 06-18-2008, 08:36 AM
Super Moderator
noobee
 
Join Date: Jun 2008
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with SQl.....?

Code:
$strSQL = "SELECT count (*)FROM information_schema.tables;
WHERE table_schema=naughtylist AND table_name=naughty";
Don't just throw a SQL query into PHP... put it in a string and run the query with

$res = mysql_query ( $strSQL );
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-18-2008, 05:54 PM
directory_man's Avatar
Super Moderator
noobee
 
Join Date: Jun 2008
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
Default Help with SQl.....?

Try below code:
Code:
<?php
require 'config.php';
$username=$_POST['username'];
$offence=$_POST['offence'];
$punishment= $_POST['punishment'];

mysql_connect ($dbhost,$dbusername,$dbpassword); //used to conneect to the mysql database
mysql_select_db("naughtylist") or die (mysql_error());
mysql_query("SELECT count (*)FROM information_schema.tables WHERE table_schema=<naughtylist> AND table_name=<naughty>");
mysql_query ("INSERT INTO naughty (username, offence, punishment) VALUES ('$username','$offence', '$punishment')");

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 12:17 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Ad Management by RedTyger