abouchoud
-
Posts
6 -
Joined
-
Last visited
Never
Posts posted by abouchoud
-
-
I don't understand the it's coded!
Its normal that's always gona give you the echo " YOU DO NOT HAVE ACCESS";
because when your if condition is at true it will directly go through the If condition and the While also.
plus like they said, why are you affecting the $row variable with the $user value ?? I think what you wanted to do is to affect the $user variable with the $row['userlevel'] value.
Why is there the exit. By itself it doesnt do much ... you need to have another condition that when it's true ... the while loop would break and continue into your code....
but, you really need to revise your code cuz its wrong!.
thanks
-
... never mind
not to familiar with that function....
sorry!!
-
ok
No it is completly wrong. This function is not used correctly. What I understand from that function is that, it protects the special caracters that your $insert string variable contains. But, it has not the ability to deconcatenate the string. Plus, the way you inserted the date in to your $insert string variable is wrong too!
let say you have 3 values to enter as the example you provided us:
example :
the $insert string variable now contains :
chadchad@hotmail.com08-07-0804:47:58pm,chrischris@hotmail.com08-07-0804:47:58pmnatashanatasha@hotmail.com08-07-0804:47:58pm
I don't see how you can separate you values of each record in you $insert string variable.
You need, first of, to find a way to save the values like this:
chad&&chad@hotmail.com&&08-07-0804:47:58pm,chris&&chris@hotmail.com&&08-07-0804:47:58pm,natasha&&natasha@hotmail.com&&08-07-0804:47:58pm
then after that you have to try to insert your values by deconcatinating you $insert string so it match your table column (name, email, time)
-
hello,
here is an example... you can find it on php.net by searching for the mysql_real_escape_string function!!
....
....
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password');
if(!is_resource($link)) {
echo "Échec de la connexion au serveur\n";
// ... historisation de l'erreur
} else {
// Annule les effets magic_quotes_gpc/magic_quotes_sybase sur ces variables si ON.
if(get_magic_quotes_gpc()) {
$product_name = stripslashes($_POST['product_name']);
$product_description = stripslashes($_POST['product_description']);
} else {
$product_name = $_POST['product_name'];
$product_description = $_POST['product_description'];
}
// Faire une requête sécurisée
$query = sprintf("INSERT INTO products (`name`, `description`, `user_id`) VALUES ('%s', '%s', %d)",
mysql_real_escape_string($product_name, $link),
mysql_real_escape_string($product_description, $link),
$_POST['user_id']); mysql_query($query, $link);
....
....
-
hello,
you can write it like that :
SELECT Count(*) AS Amount, cat.Category
FROM tboffence AS ofc
LEFT JOIN (tblcategory AS cat, tblmisdemeanourtype AS mis, tbjustification AS jus)
ON (ofc.CategoryID = cat.ID, ofc.MisdemeanourTypeID=mis.ID, jus.OffenceID=ofc.ID)
WHERE ofc.StudentID=222 AND ofc.OffenceDate >= '2008-06-02'
AND ofc.OffenceDate <= '2008-08-29' AND (jus.Accepted!=1 OR jus.Accepted IS Null)
GROUP BY cat.Category;
Re: mysql select question
in PHP Coding Help
Posted
Use the (LEFT|RIGHT) JOIN FOR THAT
EX.:
SELECT * FROM test1 LEFT JOIN test2 ON test1.column1=test2.column