| | i dunno why this query doesn't function.. CODE $sql="SELECT count(*) FROM participantes,sancionados WHERE participantes.No_Ficha = '$no_ficha' or sancionados.No_Ficha='$no_ficha'"; $query=($sql); any suggestion??? |
|
|
CODE$sql="INSERT INTO `tablename` (`colname1`, `colname2`) VALUES ('value1', 'value2')";If you follow the above format, the insert query should work fine.You may have to define the columns name and data parallel to each other.
CODE $sql="SELECT count(*) FROM participantes, sancionados WHERE `participantes`.`No_Ficha` = '$no_ficha' AND `sancionados`.`No_Ficha`='$no_ficha'"; $query=$sql; try the above code.
Try this:-
CODE $sql="SELECT count(*) FROM `participantes`, `sancionados` WHERE `participantes`.`No_Ficha` = '".$no_ficha."' AND `sancionados`.`No_Ficha`='".$no_ficha."'"; $query=$sql; or this:- CODE $sql="SELECT count(*) FROM `participantes` WHERE `No_Ficha` = '".$no_ficha."'"; $query=$sql; if it still doesn't not work, i will have to get back to you later today or tomorrow.
Maybe you're not doing the query, you're just setting $query to $sql, you have to use $query = mysql_query($sql) or die("Maybe you were right?");
Other than this, I can't see a problem. MC QUOTE $sql="SELECT count(*) FROM participantes,sancionados WHERE participantes.No_Ficha = '$no_ficha' or sancionados.No_Ficha='$no_ficha'"; $query=($sql); See from your query, I figure you are trying to match up the contents of the variable $no_ficha with the table columns participantes.No_Ficha and sancionados.No_Ficha. the query is perfectly fine and wouldn't even need the open-close quotes (``) around the table/column names as shown here. QUOTE `participantes`, `sancionados` WHERE `participantes`.`No_Ficha` = '".$no_ficha."' AND `sancionados`.`No_Ficha`='".$no_ficha."'"; My guess is where you are going wrong is the open-close quotes ('') around the $no_ficha.... if you want to match the contents of $no_ficha with your table columns, then you have to enclose $no_ficha in double quotes ("$no_ficha") for PHP to be able to parse it as a variable and extract and use its value. Between single quotes, $no_ficha is treated as a string and you query is trying to find a string called $no_ficha in your tables... Try with double quotes and see.... I think breaking up the query like this would help: $sql="SELECT count(*) FROM participantes,sancionados WHERE participantes.No_Ficha =" . "$no_ficha" . "or sancionados.No_Ficha = " . "$no_ficha"; ... ... And next check your syntax and add what mastercomputers wrote... QUOTE Maybe you're not doing the query, you're just setting $query to $sql, you have to use $query = mysql_query($sql) or die("Maybe you were right?"); - coz it seems from your syntax that you aren't doing to query at all...
I see where you're coming from microscopic^earthling and I did too pick this up.
The only thing if I can explain it to you is that the single quotes are inside double quotes, meaning they play no importance other than being single quotes in a double quoted string. Because the double quoted string is used and there's no closing prior the single quotes, the variables will be processed by PHP as variables inside that double quoted string and not as if they were singluarly quoted. e.g $double_quoted = " '$hello' "; produces 'the_element_contained_in_hello' with the quotes. If it were only $single_quoted = ' "$hello" '; produces only "$hello", with the double quotes around it and not what's contained in the variable $hello. You need to use those quotes in those statements though, so never leave them off. MC
// Added Aliases just to avoid those big lengthy names
CODE $sql=" SELECT count(*) FROM participantes AS a, sancionados AS b WHERE a.No_Ficha = '$no_ficha' OR b.No_Ficha='$no_ficha'; "; $sql_result = mysql_query($sql,$connection) || die(mysql_error()); Check the Following, The Column names are Case-sensitive and they are properly written. If the things still dont work, Would you please put down the error statement reported by the "mysql_error()" function. -OpaQue
a part of my code...
CODE $sqlcheck="SELECT count(*) FROM participantes AS a, sancionados AS b WHERE a.No_Ficha = '$no_ficha' OR b.No_Ficha='$no_ficha';"; $querycheck=mysql_query($sqlcheck) || die(mysql_error());; if(@mysql_result($querycheck,0,0)>0) { $merror.="<p style=\"color:#990000; font-weight:bold\">JUGADOR YA REGISTRADO Ó SANCIONADO <img src=\"./imgs/error.gif\" alt=\"\"></p>"; } else { $sql="UPDATE equipos SET integrantes_restantes='$integrantesr' where Centro_de_Trabajo='$centro_trabajo' and Deporte='$deporte'"; $query=mysql_query($sql); $sql="INSERT INTO participantes VALUES (0,'$nombre','$ape1','$ape2','$no_ficha','$situacionc','$talla','$anios','$deporte','$rama','$centro_trabajo','$enc_reg','$fecha'"; $query=mysql_query($sql); @$merror.="<p>Jugador ".$nombre." ".$ape1." ".$ape2." <strong>Registrado</strong> <img src=\"./imgs/oki.gif\" alt=\"\"></p>"; } the insert query doesn't function either thank u guys ... greetings from México City Latest EntriesCODE $sql="INSERT INTO `tablename` (`colname1`, `colname2`) VALUES ('value1', 'value2')"; If you follow the above format, the insert query should work fine. You may have to define the columns name and data parallel to each other.
Recent Queries:-
Keywords : mysql, query, needed
(4) any website provide free host mysql host? i need it because i am using 000webhost.com now but it (10) Iam assuming the information in the databases i will create will be stored in the 500 MB space i XD (9) I posted PHP on computer? , but for some reason it doesn't show :/. Anyways I am wondering if (2) Hello .. I would like to ask if i can use use Microsoft excel files in order to make entries to (1) Hi i am new, I have a problem in understanding the query decomposition in D-DB. Can anyone help me (0) HI, I've hit the grain while trying to import file to mysql database - I need to enable file mysql connection error (7) ok so here's my web page... http://lacrossems.t35.org/ it only lags cause its trying to (4) I just got my site hacked!! (don't worry because it is not on astahost) Actually it is a (6) SUN bought the swedish company MYSQL for much money, around 2million each worker got in the company, Linking tables (1) Hello guys, I'm making a PHP/MySQL site for a friend of mine who plays an online game where you Come in here if you think MySQL is soo hard! (14) Doesn't anybody think MySQL is so hard to code? I mean think about it, you need loads of help me lol, (3) ok im a real noob to this myswql stuff i know what its for but can any1 write me a script for it for (4) Im not understanding MySql stuff can someone help me when u got to the MySql site and all that other (9) I have problems running PHP MySQL function in a windows set web environment. PhP scripts are Using subqueries in MySQL. Very helpful. (1) This method is very useful. I always use this when simple queries of linking two tables is not POLL!! Choses you preferred db s/w! (9) Hey Everyone!, Please choose your preferred database s/w! Regards, Avell.... How do i do this? (5) Hi guys, ive got a registration system that looks something like the one below: Firstname: HELP! I can't get my php documents to work with the mySQL (6) i have a server that says it allows php and mysql and in the control panel i can access mysqladmin When trying to install Joomla (15) I don't know if this is the correct forum, but here is my question: I'm trying to test Please Help! (8) I seem to have a problem with accessing my database with proper permissions. I have set the my is Navcat any good? (8) Hello all, i ve recently come across NavCat (GUI tool) for MySQL. I have not bought a copy yet, just (4) Hello to all of you beautifull people out there, I am new to MySQL, i just wanted to know if its a (24) Ok, I'm coding a project which is a leap than what I'd normally do. Before, I've always (18) I am new to MySql and have just created a database after using a script. My problem is not the Help me connect my flash Work with MySql (8) I know Flash and mysql but could not figure out if I could ever connect these? I want to have a (4) Hi..I want to ask if its possible to automatically mirror my mysql databases into another mysql (8) I have a couple of .frm files with no corresponding data or index files. Is it possible to recover how to replicate mysql in realtime (4) i dont know if this might be useful to ppl here, but this is a very good knowledge for serious (3) I'm trying to insert about 500 rows into mysql, but I keep getting errors. If I copy and paste Looking for mysql, query, needed
|
|
![]() MySQL Query - some help needed |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute more info. to help others. Ask your Doubts & Queries to get answers, So that "Together We can help others!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|