To talk on Icrontic, just register!

It only takes 30 seconds.

Have an account? Sign in:

Forgot?
Enverex
~-+-~
Enverex
5,852 Posts

Thumbs down MySQL Table Selecting

Been trying for ages but cant get it to work. How do you select multiple tables in MySQL using PHP, my code is as follows -

PHP Code:
if ($_REQUEST['letter'] == "all") {$Letter '123, A, B, C, D, E, F, G, H, I, J, K, L, M, N, I, O, P, Q, R, S, T, U, V, W, X, Y, Z' ;}else{$Letter $_REQUEST['letter'];};

if( !isset(
$_GET['k'])) {
$SQL="SELECT COUNT(*) AS Total FROM `$Letter`";
$SQL_Result=mysql_db_query($DB_Name$SQL);
$SQL_Result_Array=mysql_fetch_array($SQL_Result) || die(mysql_error());
$Total=$SQL_Result_Array['Total'];
// Create a new SELECT Query with the ORDER BY clause and without the COUNT(*)
$SQL="SELECT * FROM `$Letter` ORDER BY Name";
}else{
$k $_REQUEST['k'];
// Run The Query Without a Limit to get Total result
$SQL="SELECT COUNT(*) AS Total FROM `$Letter` WHERE Name LIKE $k";
$SQL_Result=mysql_db_query($DB_Name$SQL);
$SQL_Result_Array=mysql_fetch_array($SQL_Result) || die(mysql_error());
$Total=$SQL_Result_Array['Total'];
// Create a new SELECT Query with the ORDER BY clause and without the COUNT(*)
$SQL="SELECT * FROM `$Letter` WHERE Name LIKE $k ORDER BY Name";
}; 
Its just the "{$Letter =" bit I need to find out, i.e. is there a "select all tables" command, or if not, how do I need to format the table syntax?

Cheers, off to bed now gnight,
NS
__________________ RetroTracks - Classic Computer and Game Music
Enverex
~-+-~
Enverex
5,852 Posts
Yeah, I nearly had to tear out my retinas after looking at it (thinks back to the "Amazing seizure robots" episode of the Simpsons).

lol,
NS
danball1976
Veteran Icrontian
danball1976
2,634 Posts
Can just barely ready the green
__________________
Visit my Deviant Art profile - Visit my Fur Affinity profile
res00vaz
New to the neighborhood
res00vaz
3 Posts
easy click & hold cursor over text to select
danball1976
Veteran Icrontian
danball1976
2,634 Posts
Originally posted by res00vaz
easy click & hold cursor over text to select
I knew that.

BTW, this forum needs smileys on the left of the post reply box dialoge
Coaster
Icrontian
Coaster
815 Posts
its just as easy to put semi-colon right bracket, or

But thats me.

I'll add your suggestion, thanks Dan
Enverex
~-+-~
Enverex
5,852 Posts
Um...... is there going to be an easy way of doing this as there are going to be 27 tables and 2000 records (6 fields each) per table...

NS
Chilak
Icrontic Convert
Chilak
20 Posts
I would assign 1 array with all the table names. And assign numbers to them. Then use a for statement to gather all the info.
__________________
Enverex
~-+-~
Enverex
5,852 Posts
er..............

<------ MySQL n00b

NS
Enverex
~-+-~
Enverex
5,852 Posts
Sorry, my eyes hurt and that Red On Blue is just going to make them explode....

NS
Enverex
~-+-~
Enverex
5,852 Posts
uuuuuhhhhhhhh...........

I still cant figure this out, so i'll give you a bit more info, see if you can give me more of a push in the right direction.

The tables are: `123` and the Letters from A to Z, and the field it needs to be searching is called 'Name' which is all in the database named 'amigagames'.

Any ideas?
NS
nekromancerus
Icrontic Technician
nekromancerus
58 Posts
I didn't know shit about SQL and I had to learn the basics and I found these sites to be a great help. Now I know a tiny bit more than shit.

http://sqlcourse.com
http://sqlcourse2.com
Go Back   Icrontic Forums > Tech: Software > General Software
Jump to
This Thread Search this Thread
Search this Thread:

Advanced Search


Current time: 3:44am (GMT)
Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Get Vanilla instead. Trust me.