its a phpbb2 forum
I dont have a config.php?
I deleted config because it said too- is there a default one I can download and add to it?
$query=mysql_query("INSERT INTO watch_list( username - offence - punishment - offence_text )VALUES( $username - $offence - $punishment - $offence_text )");
Seems there are is a syntax errror with the above query.
<?php
$username= $_POST[ username ] ;
$offence = $_POST[ offence ] ;
$punishment=$_POST[ punishment ];
$offence_text=$_POST[ offence_text ];
$dbhost= localhost ;
$dbuser = root ;
$dbpass = a ;
$conn=mysql_connect($dbhost-$dbuser-$dbpass) or die( Sorry T- error! );
if ($conn){ echo Connected to MySQL ;}
mysql_select_db("offender_list")or die(mysql_error());
$query=mysql_query("INSERT INTO watch_list ( username - offence - punishment - offence_text )VALUES( $username - $offence - $punishment - $offence_text )");
if($query){echo "Your information has been successfully added to the database.";}
else {echo mysql_error();} // remove mysql_error() before final version is completed
?>
Thats it in full..
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near watch_list ( username - offence - punishment - offence_text )VALUES
Is the error message
$query=mysql_query("INSERT INTO watch_list ( username - offence - punishment - offence_text ) //
VALUES( $username - $offence - $punishment - $offence_text )");
Ive put the VALUES line onto a fresh line so you can see it.
VALUES( $username - $offence -
$punishment - $offence_text )");
VALUES( $username -
$offence -
â˜$punishmentâ™-
â˜$offence_text )
");
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near mysql_query(INSERT INTO watch_list ( username - offence - punishment - offence_ at line 1
the form below has the following fields: username- password and search area. The user will type their username/password and key in search criteria to search my vdatabase. Then the PHP script below will process it.
I would like the search bit to be on the main page on my website (just like Yahoo or Google:-) but unlike Yahoo/Google- when the user presses search- they will be asked to provide their login info i.e. user and pass. If all if well- they will get the results from the database.
How can i modify the code below to achieve this? thanks a lot.
<form method="post" action="search.php">
User: <input type="text" name="username">
Password:<input type="password" name="password">
Search for: <input type="text" name="search">
<input type="submit" name="submit" value ="Search">
</form>
<?php
$user = $_POST[ username ];
$pass = $_POST[ password ];
If ($_POST[submit] == "Search") {
mysql_connect("mysql"- $user- $pass)
Or die(mysql_error());
echo "<p>Thanks for using PowerSearch. Your search results for <b>$_POST[search]</b> are: </p>";
mysql_select_db("Country");
$query = "select * from Articles where Author like %$_POST[search]% ";
$result = mysql_query($query);
echo "<table width= 600 border= 1 cellpadding= 5 ><tr>";
echo "<th align= left width= 200 >Title</th><th align= left width= 100 >Author</th><th align= left width= 200 >Content</th>
<th align= left width= 100 >Date</th></tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr><td>".$row[0]."</td>";
echo "<td>".$row[1]."</td>";
echo "<td>".$row[2]."</td>";
echo "<td>".$row[3]."</td></tr>";
}
echo "</table>";
}
?>
Mike- thanks for that suggestion: yes i tried exactly that: first a form to ask for search criteria- then in one page i created a form for passd and username and php script- all in one page- but used action="php-self" thing instead of the search.php as shown above for the form to submit to itself. i got it wrong in how to store the search string- so it didnt work: ) but what you suggested is exactly what i wish to do.
topnotch- that would require a "real" techie to do that it seems :-)))
also the If ($_POST[submit] now got me confused :-)
C B that is an interesting point- but as a newbie- I am not sure about how that happens. How could users access the database otherwise? thanks man.
can just use flash+php&Mysql- if so how?
<?php
$username= $_POST[ username ] ;
$offence = $_POST[ offence ] ;
$punishment=$_POST[ punishment ];
$offence_text=$_POST[ offence_text ];
$dbhost= localhost ;
$dbuser = root ;
$dbpass = a ;
mysql_connect($dbhost-$dbuser-$dbpass) or die( Sorry T- error! );
echo "Connected to MySQL <br />";
mysql_select_db("offender_list") or die(mysql_error());
mysql_query("INSERT INTO watch_list VALUES( $username - $offence - $punishment- $offence_text -)");
Print "Your information has been successfully aded to the database.";
?>
I have mysql adminstrator...and i created the table prior to executing that code- no luck. I tried creating the table in the above code by including
CREATE TABLE "watch_list" (
`username` VARCHAR (30) NOT NULL-
`offence` VARCHAR(45) NOT NULL-
`punishment` VARCHAR(45) NOT NULL-
`offence_text` VARCHAR(500) NOT NULL-
PRIMARY KEY (`username`)
)
But that causes errors for the php.
Even if I have the table- it is not being populated.
Ok Ive altered the syntax- and it seems that I am a step further- I can now getting an SQL error:
$query=mysql_query("INSERT INTO watch_list( username - offence - punishment - offence_text )VALUES( $username - $offence - $punishment - $offence_text )");
i would like to have a database for a preferred vendor list...what is a good database program where i can build a database that can add a vendor- modify a vendor- delete a vendor and search for a vendor and then have a link on the database that links to a survey for a vendor rating?? i want to be able to store all of this information and have reports when my employees are entering the information...so which do you recommend for something like this? MySQL? Microsoft Access? or anything else??
also- what is involved in building a database? what is the criteria? for the information that i mentioned above should i build one Master table or do I need more? any information on this would be great! 10 points for great answer and a lot of info
No comments:
Post a Comment