-
Posts
1,686 -
Joined
-
Last visited
Never
Posts posted by Lamez
-
-
Okay, I am getting a error with my query. I am sure it's nothing, but I cannot find it. I just need a fresh pair of eyes.
Here is the error:
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 'key, ip, first, last, email, disp, review) VALUES ('0', '6a4c85fbb4772a41f645b8a' at line 1Here is the code:
<?php $q = "INSERT INTO `reviews` (valid, key, ip, first, last, email, disp, review) VALUES ('".$valid."', '".$key."', '".$ip."', '".$fname."', '".$lname."', '".$email."', '".$disp."', '".$review."')"; mysql_query($q) or die(mysql_error()); ?>
Oh, Here is the Database Structure:
id
post
vaild
key
ip
first
last
email
disp
review
-Thanks Guys!
-
no I fixed it
-
My action script that adds points to the users, and updates the database is not doing any of the mysql querys, it has work times and times before, but not now for some reason. It does redirect, but it does not echo anything out. I have no idea why.
Here is the code:
<?php ob_start(); $path = "../../"; $title = "Update Winners"; $u_login = "yes"; $admin = "yes"; include ($path."main/include/cons/head.php"); if(siteStat() == "Basketball" && $basketReg == 0){ function getPnts($round){ $f = mysql_fetch_array(mysql_query("SELECT * FROM `basket_pnts` WHERE `round` = '".$round."'")); return $f['value']; } $i = 1; $cnt = 1; while($i<=16*4){ if($i <= 16*1){ $r = "a"; }else if($i <= 16*2){ $r = "b"; }else if($i <= 16*3){ $r = "c"; }else if($i <=16 *4){ $r = "d"; } $win = $_POST[$cnt."_".$r]; $spot = $cnt; $round = $_POST['round']; if(!empty($win)){ mysql_query("INSERT INTO `basket_winner` (team, region, spot, round) VALUES ('".$win."', '".$r."', '".$spot."', '".$round."')")or die(mysql_error()); $pnt = getPnts($round); $table = "basket_rnd".$round; $q = mysql_query("SELECT * FROM `".$table."` WHERE `".$spot."` = '".$win."' AND `region` = '".$r."'"); while($f = mysql_fetch_array($q)){ $usr = $f['user']; $p = mysql_query("SELECT * FROM `basket_usrpnts` WHERE `user` = '".$usr."'"); $p = mysql_fetch_array($p); $brnd = "rnd".$round; $rnd = $p[$brnd]; $total = $p['total']; $rnd+=$pnt; $total+=$pnt; mysql_query("UPDATE `basket_usrpnts` SET `".$brnd."` = '".$rnd."', `total` = '".$total."' WHERE `user` = '".$usr."'"); echo $table." ".$spot." ".$usr." ".$pnt; } } $i++; if($cnt <= 16){ $cnt++; }else{ $cnt = 1; } } //header("Location: up_win.php"); }else{ header("Location: ../index.php"); } include ($path."main/include/cons/foot.php"); ?>
-
w00t, that worked, but now why does it not redirect?
oh forgot the :
-
so like:
<?php mysql_query("INSERT INTO `basket_rnd1` (user, region, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`) [..] "); ?>
-
I keep getting a mySql error, but I have no idea why, can someone help me look for the error?
This is the Error:
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 '1, 2, 3, 4, 5, 6, 7, VALUES ('Lamez', 'a', 'Louisville', 'Ohio St.', 'Utah', ' at line 1<?php mysql_query("INSERT INTO `basket_rnd1` (user, region, 1, 2, 3, 4, 5, 6, 7, VALUES ('".$user_."', '".$x."', '".$a."', '".$b."', '".$c."', '".$d."', '".$e."', '".$f."', '".$g."', '".$h."')") or die(mysql_error()); ?>
Whole Code:
<?php ob_start(); $path = "../../"; $title = "Basketball Bracket"; $rank = "yes"; $u_login = "yes"; include ($path."main/include/cons/head.php"); $y = $_SESSION['xz']; $end = "endRnd_on"; $end2 = "endRnd_on2"; $end3 = "endRnd_on3"; $end4 = "endRnd_on4"; if($y == $end || $y == $end2 || $y == $end3 || $y == $end4){ if($y == $end){ $region = 1; $x = "a"; $re = "b"; } else if($y == $end2){ $region = 2; $x = "b"; $re = "c"; }else if($y == $end3){ $region = 3; $x = "c"; $re = "d"; }else if($y == $end4){ $region = 4; $x = "d"; $re = "e"; }else{ header("Location: ?yyz=r112d"); } $a = $_POST['1']; $b = $_POST['2']; $c = $_POST['3']; $d = $_POST['4']; $e = $_POST['5']; $f = $_POST['6']; $g = $_POST['7']; $h = $_POST['8']; $i = $_POST['9']; $j = $_POST['10']; $k = $_POST['11']; $l = $_POST['12']; $m = $_POST['13']; $n = $_POST['14']; $o = $_POST['15']; mysql_query("INSERT INTO `basket_reg` (id, name) VALUES ('1','A')")or die(mysql_error()); mysql_query("INSERT INTO `basket_rnd1` (user, region, 1, 2, 3, 4, 5, 6, 7, VALUES ('".$user_."', '".$x."', '".$a."', '".$b."', '".$c."', '".$d."', '".$e."', '".$f."', '".$g."', '".$h."')") or die(mysql_error()); mysql_query("INSERT INTO `basket_rnd2` (user, region, 9, 10, 11, 12) VALUES ('".$user_."', '".$x."', '".$i."', '".$j."', '".$k."', '".$l."')") or die(mysql_error()); mysql_query("INSERT INTO `basket_rnd3` (user, region, 13, 14) VALUES ('".$user_."', '".$x."', '".$m."', '".$n."')") or die(mysql_error()); mysql_query("INSERT INTO `basket_rnd4` (user, region, 15) VALUES ('".$user_."', '".$x."', '".$o."')") or die(mysql_error()); header("Location index.php?region=".$re); }else{ echo "ERROR!"; } ?> <?php include ($path."main/include/cons/foot.php"); ?>
Any Ideas?
Thanks Guys
-
Lamez, here in America, we don't go to jail for questioning the government. I do not think people should ever have to live under a government that they did not choose to live under.
Also, just because an economy is good doesn't mean a government is good for its people.
Just because he's in the middle of it he has no reason to complain? So it's his fault he lives in China.
Wow.
sure if you want to look at my post in that perspective.
-
take a look at servage, they have good hosting, there is a link in my sig. I get tons of space for DB's.
-
I have modded my xbox and when I was starting I found another community, and they have tutorials on their website, so take a look here:
-
China is top of the world with their economy, so they know what they are doing, and just because you are in the middle of it, does not give you a reason to complain. (run on ) Ya I live in America, and we Americans get what we want. I am sorry you live in a strict environment, but you do not have any reason in the world to break the rules, so get over it.
-
Living in a strict environment is no excuse to break the rules every once and a while.
-
-
Damn Small Linux.
-
I usually only post here when I am tired and cannot find the problem, but I think I will not be able to solve this one when I am mentally sober.
This bit of code below is suppose to check to see if the user has added the other user as their friend, if so it will return a error message, well I do believe I tested it before, but that was before I added someone else as my friend, meaning you get the error no matter what when you have more than one friend!
Does anyone know why?
Code:
<?php $f_id = findInfo($user, "id"); $q = mysql_query("SELECT * FROM `friends` WHERE `a` OR `b` = '".$f_id."'"); $f = mysql_fetch_array($q); if($f['a'] == $f_id){ $n == 1; }else{ if($f['b'] == $f_id){ $n == 1; }else{ $n == 0; } } if($n == 1){ echo "<b>".$user."</b> is your friend already"; } ?>
findInfo function:
<?php function findInfo($user, $what){ $q = mysql_query("SELECT * FROM `users` WHERE `username` = '".$user."'"); $f = mysql_fetch_array($q); return $f[$what]; } ?>
-
I am trying to get my insert query to insert a 1 in the accept field, but it is add a 0 instead. Here is the code:
<?php $me_id = findInfo($user_, "id"); $them_id = findInfo($a_usr, "id"); mysql_query("UPDATE `friends` WHERE `friend_id` = '".$them_id."' AND `user_id` = '".me_id."' SET `accept` = '1'"); mysql_query("INSERT INTO `friends` (user_id, friend_id, accept) VALUES('$me_id', '$them_id', '1')")or die(mysql_error()); echo "<b>".$a_usr."</b> has been added as your friend!"; ?>
no errors are being returned. The update query works, but not the insert!
-
eh, its no big deal.
-
lol, they should make it where the parents can add websites with like a master password, or some sort.
-
I went to the domain, and all I got was a blank page, of course on the port you have listed above. My home server has a domain that is pointed to my server from servage's servers but, I cannot load my website using the domain, when I am on my network, I have to use the host name, "megatron". I have no idea why, and it just changed on me all of a sudden, but that might be your problem, try loading the website from a different computer off your network.
You probably don't care at this point, but if you ever wanted to use the full domain name, you could just modify your hosts file (C:\Windows\System32\drivers\etc\hosts) to have your host name redirected to megatron.
lol its a linux server!
-
-
thanks, but does anyone have like hotmail, or something else?
-
-
I do not understand what you mean by "normal practice" you can post a link to the script, and there are some testers here that will have a whack at it. Be sure you do follow this:
http://www.phpfreaks.com/forums/index.php/topic,231599.0.html
-
yes do not be afraid to get your hands dirty, and your mind going. It will help you a lot if you learn PHP and MySQL Databases. I am so glad I decided to learn, now I am a script junkie.
-
oh I see.
handling files from different folders
in PHP Coding Help
Posted
I am a bit lost on your question.
You can call files from different folders with php, and include them in the current script.
Such as:
Maybe you can rephrase your question.
-Lamez