panquetofobia
Feb 2 2005, 06:20 AM
| | 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??? |
Reply
avalon
Feb 2 2005, 06:42 AM
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.
Reply
panquetofobia
Feb 2 2005, 07:00 AM
doesn't function.... but thank u so much avalon
Reply
avalon
Feb 2 2005, 07:09 AM
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.
Reply
mastercomputers
Feb 2 2005, 09:25 AM
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
Reply
miCRoSCoPiC^eaRthLinG
Feb 2 2005, 11:04 AM
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...
Reply
mastercomputers
Feb 2 2005, 11:14 AM
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
Reply
miCRoSCoPiC^eaRthLinG
Feb 2 2005, 11:43 AM
Righton  thanks for clearing it up...it got a little fuzzy seeing so many quotes flying around
Reply
OpaQue
Feb 2 2005, 11:56 AM
// 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
Reply
panquetofobia
Feb 2 2005, 06:16 PM
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
Reply
avalon
Feb 3 2005, 06:14 PM
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.
Reply
Recent Queries:--
mysql query decomposition - 8.63 hr back. (1)
-
deporterama - 64.37 hr back. (1)
-
query mysql import - 132.60 hr back. (1)
-
mysql query 2 tables - 159.88 hr back. (1)
-
php mysql query insert into - 171.29 hr back. (3)
-
mysql count vs variable adding - 291.63 hr back. (1)
-
sample mysql queries - 346.49 hr back. (1)
-
if mysql query - 384.61 hr back. (1)
-
mysql insert query - 395.11 hr back. (2)
-
mysql records count in query - 397.66 hr back. (1)
-
mysql query variable - 475.94 hr back. (1)
-
my sql help - 491.17 hr back. (1)
-
mysql queries - 496.33 hr back. (1)
-
sql query line break - 538.92 hr back. (1)
Similar Topics
Keywords : mysql, query, needed
- Login System
I want to make a login system using Mysql. I am amateur in these thing (6)
Mysql Overhead
(3) Sometimes in a table especially if i do alot of things in it i start seeing overhead then a size
near it? what is overhead? and is it essential to optimize the table to fix it? I know its just a
press of a button but i'd like to know what happens when i optimize a table. Also when you make
a new table you can limit the size of VARCHAR to a number, that number would be the number
characters allowed in that column per entry. I'd like to know how the limit works for texts, is
it in KB? or number of characters? Cuz i made a messaging system. And i remember reading s....
Mysql Multiple Tables
(1) It is good practice to use multiple tables to sort out big amounts of data. But once you do that it
becomes increasingly hard to cross reference the tables. Mysql has a little beautiful command
structure that they have added. You can select multiple tables within one sql query. Example of a
basic sql query CODE $sql = "SELECT * FROM table WHERE row=1"; If you noticed that I selected
all of the rows in the table. Normally you will try to not select the entire table from the database
unless you absolutely want all of the table. I would recommend against it; just gra....
Any Website Provide Free Host Mysql Host?
(4) any website provide free host mysql host? i need it because i am using 000webhost.com now but it
only provide 2 mysql database... can i know where or how can i get more databases regards....
Space Needed For Database
(10) Iam assuming the information in the databases i will create will be stored in the 500 MB space i
get, but since 500MB isn't enough iam wondering if you guys can tell me how much bytes the
following take: Varchar(x),Tinyint,Text,date,smallint,mediumint,bigint,float.... And the rest
present when you add/edit a row in a table. Also what are the ranges of tinyint,smallint,mediumint
and big int....
Mysql On Computer
XD (9) I posted PHP on computer? , but for some reason it doesn't show :/. Anyways I am wondering if
there is MYSQL on my computer, meaning can i make a data base on my computer? that way i make what i
want and upload it when i get hosted =)....
Mysql Database Entry By Excel Sheets
(2) Hello .. I would like to ask if i can use use Microsoft excel files in order to make entries to
mysql database. Thanks....
Mysql Database Management
(1) Hi i am new, I have a problem in understanding the query decomposition in D-DB. Can anyone help me
to understand the first question of the exercise 25.21 of Elmasri-Navath 4th edition? Consider the
following relations: BOOKS (Book#, Primary_author, Topic, Total_stock, $price) BOOKSTORE (Store#,
City, State, Zip, Inventory_value) STOCK (Store#, Book#, Qty) Consider a distributed database for a
bookstore chain called National Books with 3 sites called EAST, MIDDLE, and WEST. Consider that
BOOKS are fragmented by $price amounts into: B1:BOOK1:up to $20. B2:BOOK2:from ....
Mysql And User File_priv
(0) HI, I've hit the grain while trying to import file to mysql database - I need to enable file
permissions of the database user but this seems not possible with most of the hosting providers.
The problem is to set file_priv of the database user to "Y" . This is done in the "user" table of
the maintanance database named "mysql". cPanel doesn't allow this. Via the cPanel you can only
allow privileges on table querries but you cannot grant host file privileges to the database user -
which makes querries like: "LOAD DATA INFILE 'filename' INTO TABLE tablen....
I Have An Error With My Mysql Connection
mysql connection error (7) ok so here's my web page... http://lacrossems.t35.org/ it only lags cause its trying to
connect to the my sql server...i followed this guide
http://forum.ragezone.com/showthread.php?t=387249 and when i edit my config.php to my host and
login info i always get the error cannot connect to the database here is my config.php if you can
help me CODE $host = 'CENSORED'; // my host $host =
'righto'; // my database username $host = 'CENSORED'; // my database
password $host = 'odinms'; // my datab....
Mysql Backup With Another Address?
(4) I just got my site hacked!! (don't worry because it is not on astahost) Actually it is a
wordpress blog. So I backed up my MySQL Databases with cpanel. Now when I get my hosting approved
here at astahost, can I restore those backups? Is the change of the site address going to interfere
with this? Is there anyway I can edit those databases to work with my new address? Please help me
out here!....
Sun Bought Mysql
(6) SUN bought the swedish company MYSQL for much money, around 2million each worker got in the company,
they did it to come in to the database market, is it a good reson to buy it?....
Mysql Problem
Linking tables (1) Hello guys, I'm making a PHP/MySQL site for a friend of mine who plays an online game where you
can create towns, add buildings to them and upgrade them to a newer level. I've offered to make
him a small site where he can input his data into a database and keep track of his towns, buildings
and levels. I'll show you my database design and then explain what i want to do. Table: towns
field 1: TownID (primary key, auto-increment) field 2: TownName field 3: TownType field 4: Town
Description Table: buildings field 1: BuildingID (primary key, auto-incremen....
Mysql - So Hard
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
databases just for one little script and you have to type things in like ;Host-Username:
(blahblah) ;Host-Password: (blahblah) ;Host-DatabaseName: (blahblah) Ok, that MySQL code was
random, and it is alot harder than that. If you have expierenced it being hard, you are free to
post right in here, mate.....
Not Understanding Mysql
(4) Im not understanding MySql stuff can someone help me when u got to the MySql site and all that other
stuff is this like a log of your web stuff or does it help u desigen your website just wanted to
know what it does and how do u use this thing.....
Apache Php With Mysql On Windows [solved]
(9) I have problems running PHP MySQL function in a windows set web environment. PhP scripts are
executed but if I try to use mysql connect and other like functions I get a blank window (while
using the browser). The command line client is working...I've added the path to libmysql.dll
and the extension=php_mysql.dll in the php.ini.....
Subqueries In Mysql
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
enough. This method is putting a query inside a query. Example: SELECT * FROM table1 LEFT JOIN
(SELECT * FROM table2 WHERE field1='id') AS subtable or joining multiple queries SELECT *
FROM (SELECT * FROM table1 WHERE userid='001') AS subtable1 LEFT JOIN (SELECT * FROM table2
WHERE field1='id') AS subtable2 You can join more than two queries depending on the output
you want. If someone already posted this topic here I'm sorry I don't know.....
Oracle Vs. Mysql Vs. Postgresql
POLL!! Choses you preferred db s/w! (9) Hey Everyone!, Please choose your preferred database s/w! Regards, Avell....
Login System Using A Mysql Db
How do i do this? (5) Hi guys, ive got a registration system that looks something like the one below: Firstname:
Lastname: Then i have inset.php, which looks like the following: $con =
mysql_connect("localhost","autobot","abc123"); if (!$con) { die('Could not connect: ' .
mysql_error()); }mysql_select_db("my_db", $con);$sql="INSERT INTO person (username, password) VALUES
('$_POST ','$_POST ')";if (!mysql_query($sql,$con)) { die('Error: ' .
mysql_error()); } echo "1 record added";mysql_close($con) ?> Now my question is, how do i creat....
Mysql And Php
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
Joomla and some forums in my computer, I have already installed MySQL with the GUI tools, Apache,
and PHP with the MySQL and MySQLi extensions, but when I'm trying to install Joomla I get this
error: Required Settings Check: ------------------------------------- PHP version >= 4.1.0
Yes - zlib compression support Available - XML support Available - MySQL support
Unavailable configuration.php Writeable Session save path Unwriteable Not ....
Permission Problem With Mysql Database Creation
Please Help! (8) I seem to have a problem with accessing my database with proper permissions. I have set the my
database correctly giving my db username all priviliges yet i seem to be unable to even log on with
this username with a denied access error. Any ideas on resolving this?....
Navcat For MySQL
is Navcat any good? (9) Hello all, i ve recently come across NavCat (GUI tool) for MySQL. I have not bought a copy yet, just
played around with the demo. Has any one used it beore, if so please let me know if its worth
buying. I already have PhpMyadmin, Just wanna know if NavCat is better than PhpMyAdmin in usibility
and functionality. Regards....
MySQL, Multiple Tables
(24) Ok, I'm coding a project which is a leap than what I'd normally do. Before, I've always
learned ONE table... put EVERYTHING in one database table. I'm making a profile system so there
needs to be at least two tables: 1 for users, 1 for content. My problem is, how do I link the two
together? I could probably figure this out faster if someone explained and posted sample SQL code
that shows how the two are linked together. Thanks!! F....
MySQL Output Database Question
(18) I am new to MySql and have just created a database after using a script. My problem is not the
script, but what it says about putting it into the output file. I cant figure out the right terms
to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
please help me out?....
How To Connect MySQL With Flash?
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
dynamic content in my flash object that could be retrieved from the database directly without myself
needing to update it again and again. How can I achieve this ? Do I have to install any additional
controls or connectors to do that ? If yes any one tell me....
phpBB - MySQL Help Needed
sql database (11) Ok, well I origanaly installed phbb on my webspace but then switched to invision 2.0. After about 4
days of skinning, configuring, ect I opened up the forum. With this done I didnt need the phbb
forum so I went to the cpanel and removed it. After I did this My Invision forum no longer works.
Here is the error I get. CODE mySQL query error: SELECT * FROM astahost_cache_store WHERE cs_key
IN ( 'attachtypes','bbcode',
'multimod','ranks','profilefields','banfilters', 'settings',
'group_cache', 'system....
Mirror My MySQL Database To Another Mysql Server
(4) Hi..I want to ask if its possible to automatically mirror my mysql databases into another mysql
server?or create a small php script to do this? The reason is because, we all know that database is
very improtant if we have dynamic website. I have my forum hosted and i want to automatically
mirror this or backup into another mysql server(free). Like in freesql.org. So that im not afraid
that i forgot to backup my database..also i have one central backup database. Thanks for the
help..Im looking forward for this posibility.....
Recover Tables From A MySQL .frm File
(8) I have a couple of .frm files with no corresponding data or index files. Is it possible to recover
the table structure (field names, types, sizes, rows,col, etc) from these files? The table type is
innodb....
MySQL Realtime Replication
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
siteadmins. while i was digging for mysql backup techniques, i've found that mysql is able to
do realtime replication. the idea is that there are master server and slave server. both are having
the same version of mysql installed. the data flows; Master >copy> Slave ( in realtime!)
you'll never have to manually copy the database file of wasting your time to manually use the
mysqldump command. here are the links; http://dev.mysql.com/doc/mysql/en/Replication_HOWTO.h....
MySQL - Trouble With Bulk Insert Statements
(3) I'm trying to insert about 500 rows into mysql, but I keep getting errors. If I copy and paste
too many (about 50) insert statements at a time I get errors sometimes. I sometimes even get errors
but then the row is skipped so I don't know there was an error (I'm using linux and SSH).
What's the best way to get my insert statements to put the data in MySQL? Is there anyway that I
can have it tell me if there where any errors all the statements are executed? Thanks for your
help.....
Looking for mysql, query, needed
|
*SIMILAR VIDEOS*
Searching Video's for mysql, query, needed
|
advertisement
|
|