?
Solved

PHP/MySQL query using variable

Posted on 2012-08-15
8
Medium Priority
?
373 Views
Last Modified: 2012-09-20
$Result2 = mysql_query("Select Count(*) AS 1stOverall from Race_Results where `1` = '".$row['Car_Number']."'");
$data2  = mysql_fetch_array($Result2);

Car_Number should contain a value simlar to "23 R" however I need the query to not only count "23 R" but to count "23R" (no space) as well. I'm not sure how to achieve this and would appreciate the assistance.

Thank you
0
Comment
Question by:patrickm12981
  • 3
  • 3
  • 2
8 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38298556
You can use an OR statement but you need to trim the spaces in PHP to do that.

$Car_Number1 = $row['Car_Number'];
$Car_Number2 = str_replace(" ", "", $Car_Number1);
$Result2 = mysql_query("Select Count(*) AS 1stOverall from Race_Results where `1` = '$Car_Number1' OR `1` = '$Car_Number2'");

Open in new window

0
 

Author Comment

by:patrickm12981
ID: 38299066
Can this be done in-line? What is the syntax?

Something like this:
$Result2 = mysql_query("Select Count(*) AS 1stOverall from Race_Results where `1` = '".$row['Car_Number']. OR str_replace(" ", "",.$row['Car_Number']. '");
$data2  = mysql_fetch_array($Result2);
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38299211
Maybe but I never do it that way.  It is not any faster and it is harder to read and troubleshoot.  PHP goes thru and pre-compiles it before it is run.  Since those functions have to be run before you can put the results in the SQL query string,  it ends being the same thing but harder to read.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:patrickm12981
ID: 38305074
Sorry for the delayed response. Because of the way my page is structured it would best for me to do it in line. What would the correct syntax be for that? I just took a guess above.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38305634
I don't know, I never do it that way.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38309709
I think DaveBaldwin is giving you good advice.  I would only add that you should never construct a query inside the function call.  It makes it impossible to print out the contents of the query, and if the query fails, you will want that information.  And you want to learn about mysql_real_escape_string().
http://us3.php.net/manual/en/function.mysql-real-escape-string.php

You may also want to consider one of the suggested alternatives that will show up when you read the man page.

// USE THE CORRECT ESCAPE SEQUENCE
$Car_Number1 = mysql_real_escape_string($row['Car_Number']);

// MAKE AN ALTERNATE QUERY STRING FOR THE WHERE CLAUSE
$Car_Number2 = str_replace(" ", "", $Car_Number1);

// CONSTRUCT THE QUERY
$sql = "SELECT COUNT(*) AS 1stOverall FROM Race_Results WHERE `1` = '$Car_Number1' OR `1` = '$Car_Number2'";

// RUN THE QUERY AND TEST THE RESULTS
$Result2 = mysql_query($sql);
if (!$Result2) die("FAIL: $sql<br/>" . mysql_error());

// IF THE CODE GETS THIS FAR, THE QUERY SUCCEEDED

Open in new window

0
 

Author Comment

by:patrickm12981
ID: 38310122
I don't doubt the good advise at all. I'm just not 100% sure how to implement. Here is the full page:

<?php
$sqlstr = mysql_query("SELECT * FROM Roster WHERE RegYear = '2012'");
while($row=mysql_fetch_array($sqlstr)){

$Result = mysql_query("Select Count(*) AS 1stMain from Race_Results where `1` = '".$row['Car_Number']."' and `Event` = 'Main'");
$data  = mysql_fetch_array($Result);

$Result11 = mysql_query("Select Count(*) AS 1stMain from Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number where `1` =  '".$row['Car_Number']."' and Race_Results.Event = 'Main' and YEAR(Date) = YEAR(CURDATE())");
$data11  = mysql_fetch_array($Result11);

$Result2 = mysql_query("Select Count(*) AS 1stOverall from Race_Results where `1` = '".$row['Car_Number']."'");
$data2  = mysql_fetch_array($Result2);

$Result12 = mysql_query("Select Count(*) AS 1stOverall from Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number where `1` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())");
$data12  = mysql_fetch_array($Result12);

$Result3 = mysql_query("SELECT SUM(A) AS 2through5 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results 
	WHERE `2` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results WHERE `3` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results WHERE `4` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS D
	FROM Race_Results WHERE `5` = '".$row['Car_Number']."') 
	AS Total");
$data3 = mysql_fetch_array($Result3);

$Result13 = mysql_query("SELECT SUM(A) AS 2through5 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `2` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `3` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `4` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS D
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `5` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())) 
	AS Total");
$data13 = mysql_fetch_array($Result13);

$Result4 = mysql_query("SELECT SUM(A) AS 6through10 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results 
	WHERE `6` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results WHERE `7` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results WHERE `8` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results WHERE `9` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS E
	FROM Race_Results WHERE `10` = '".$row['Car_Number']."') 
	AS Total");
$data4 = mysql_fetch_array($Result4);

$Result14 = mysql_query("SELECT SUM(A) AS 6through10 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `6` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `7` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `8` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `9` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS E
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `10` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())) 
	AS Total");
$data14 = mysql_fetch_array($Result14);

$Result5 = mysql_query("SELECT SUM(A) AS 11through15 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results 
	WHERE `11` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results WHERE `12` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results WHERE `13` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results WHERE `14` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS E
	FROM Race_Results WHERE `15` = '".$row['Car_Number']."') 
	AS Total");
$data5 = mysql_fetch_array($Result5);

$Result15 = mysql_query("SELECT SUM(A) AS 11through15 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `11` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())  
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `12` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `13` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `14` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())  
	UNION ALL 
	SELECT count(*) AS E
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `15` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())) 
	AS Total");
$data15 = mysql_fetch_array($Result15);

$Result6 = mysql_query("SELECT SUM(A) AS 16through30 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results 
	WHERE `16` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results WHERE `17` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results WHERE `18` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results WHERE `19` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS E 
	FROM Race_Results WHERE `20` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS F 
	FROM Race_Results WHERE `21` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS G 
	FROM Race_Results WHERE `22` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS H 
	FROM Race_Results WHERE `23` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS I 
	FROM Race_Results WHERE `24` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS J 
	FROM Race_Results WHERE `25` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS K 
	FROM Race_Results WHERE `26` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS L 
	FROM Race_Results WHERE `27` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS M 
	FROM Race_Results WHERE `28` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS N 
	FROM Race_Results WHERE `29` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS O
	FROM Race_Results WHERE `30` = '".$row['Car_Number']."') 
	AS Total");
$data6 = mysql_fetch_array($Result6);

$Result16 = mysql_query("SELECT SUM(A) AS 16through30 FROM 
	(SELECT count(*) AS A 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number 
	WHERE `16` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())  
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `17` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `18` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `19` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS E 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `20` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())  
	UNION ALL 
	SELECT count(*) AS F 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `21` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS G 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `22` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS H 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `23` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS I 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `24` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS J 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `25` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS K 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `26` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS L 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `27` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS M 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `28` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS N 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `29` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS O
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `30` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()))
	AS Total");
$data16 = mysql_fetch_array($Result16);

$Result7 = mysql_query("SELECT SUM(A) AS DNF FROM 
	(SELECT count(*) AS A 
	FROM Race_Results 
	WHERE `DNF1` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results WHERE `DNF2` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results WHERE `DNF3` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results WHERE `DNF4` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS E 
	FROM Race_Results WHERE `DNF5` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS F 
	FROM Race_Results WHERE `DNF6` = '".$row['Car_Number']."'
	UNION ALL 
	SELECT count(*) AS G 
	FROM Race_Results WHERE `DNF7` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS I 
	FROM Race_Results WHERE `DNF8` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS J 
	FROM Race_Results WHERE `DNF9` = '".$row['Car_Number']."' 
	UNION ALL 
	SELECT count(*) AS K
	FROM Race_Results WHERE `DNF10` = '".$row['Car_Number']."') 
	AS Total");
$data7 = mysql_fetch_array($Result7);

$Result17 = mysql_query("SELECT SUM(A) AS DNF FROM 
	(SELECT count(*) AS A 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF1` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS B
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF2` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())  
	UNION ALL 
	SELECT count(*) AS C 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF3` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS D 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF4` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())  
	UNION ALL 
	SELECT count(*) AS E 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF5` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS F 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF6` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())
	UNION ALL 
	SELECT count(*) AS G 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF7` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS I 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF8` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS J 
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF9` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE()) 
	UNION ALL 
	SELECT count(*) AS K
	FROM Race_Results Join Schedule ON Race_Results.Race_Number = Schedule.Race_Number
	WHERE `DNF10` = '".$row['Car_Number']."' and YEAR(Date) = YEAR(CURDATE())) 
	AS Total");
$data17 = mysql_fetch_array($Result17);

echo "<table border=0 align='center' cellspacing='0' cellpadding='0'>"; 
echo "</td><td rowspan=8>";
echo $row['Image'];
echo "</th><td width=300 background='/images/CellBackground.png' colspan='2'><font color='#268c44'>";
echo "<img src='/images/CarDetails.png'>";
echo "</th>";
echo "<th width=300 background='/images/CellBackground.png'><font color='#268c44'>";
echo "<img src='/images/YTDStats.png'>";
echo "</th>";
echo "<th width=300 background='/images/CellBackground.png'><font color='#268c44'>";
echo "<img src='/images/OverallStats.png'>";
echo "</th></tr><tr><td width=10 background='/images/CellBackground.png'>&nbsp</td><td  background='/images/CellBackground.png' align='left'><font color='#268c44'>";
echo "<b>Car Number: </b></font></font>" .$row['Car_Number'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'><font color='#268c44'>";
echo "<b>1st in Main: </b></font></font>" .$data11['1stMain'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'><font color='#268c44'>";
echo "<b>1st in Main: </b></font></font>" .$data['1stMain']; 
echo "</td></tr><tr><td width='30' background='/images/CellBackground.png'>&nbsp</td><td  align='left' background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>Driver: </b></font>" .$row['Driver_First_Name']." ".$row['Driver_Last_Name'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>1st Overall: </b></font>" .$data12['1stOverall'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>1st Overall: </b></font>" .$data2['1stOverall'];
echo "</td></tr><tr><td width='30' background='/images/CellBackground.png'><td  align='left' background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>Home Town: </b></font>" .$row['City'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>2-5: </b></font>" .$data13['2through5'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>2-5: </b></font>" .$data3['2through5'];
echo "</td></tr><tr><td width='30' background='/images/CellBackground.png'><td align='left' background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>Cartoon Character: </b></font>" .$row['Cartoon_Character'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>6-10: </b></font>" .$data14['6through10'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>6-10: </b></font>" .$data4['6through10'];
echo "</td></tr><tr><td width='30' background='/images/CellBackground.png'><td align='left' background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>Highlight: </b></font>" .$row['Highlights'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>11-15: </b></font>" .$data15['11through15'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>11-15: </b></font>" .$data5['11through15'];
echo "</td></tr><tr><td width='30' background='/images/CellBackground.png'><td align='left' background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b></b></font>";
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>16-30: </b></font>" .$data16['16through30'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>16-30: </b></font>"  .$data6['16through30'];
echo "</td></tr><tr><td width='30' background='/images/CellBackground.png'><td align='left' background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b></b></font>" ;
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>DNF: </b></font>"  .$data17['DNF'];
echo "</td><td  background='/images/CellBackground.png'><font color='#268c44'>";
echo "<b>DNF: </b></font>"  .$data7['DNF'];
echo "</td></tr>";
echo "</table>";
echo "<hr width=1200>";
}

Open in new window

0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1000 total points
ID: 38310265
OK, I'm going to step away from this now.  It's not really a question so much as a requirement for application development.  In respect of the value of your time, I am going to recommend that you step away, too, and instead of trying to write this yourself, consider the advantages of hiring a professional developer.  You might get lucky and get some results, but from the look of the code it's not the way I would bet.  If there is any economic value to what you're building here, you would be better off to pay a professional than to build a site that can be brought down by a hacker.  If this is just a hobby and you want to use it as a chance to learn PHP and MySQL, you might want to get this book and take a structured approach to learning the technologies.  Now in its fifth printing, it has been a permanent part of my professional library since Edition One.  Very readable, great explanations and a downloadable code library that you can copy and modify for your own use.
http://www.sitepoint.com/books/phpmysql5/

Best of luck with the project, ~Ray
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this article, we’ll look at how to deploy ProxySQL.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question