-
Posts
86 -
Joined
-
Last visited
Posts posted by 87dave87
-
-
SOLVED! added px after height attribute!
-
I am having a problem validating my stylesheet.
When I change this to what it says in the valid css section the table height obviously reduces, how can I get around this and stay valid? If i can't change this in the stylesheet Im going to need to change the height on each page... which is over a hundred!
Thanks,
David.
-
Hi,
As quite a few of you may have noticed, I have been developing www.emulators.cc over the last 6 months with help along the way from users of this forum.
I am coming to the end of the development and as I am no expert in securing my website's mysql databases I need some of you to help me with checking the website for security glitches, e.g. users running queries through my input form... the search box at the top of the page.
Any advice would be appreciated.
Thanks,
David
-
If I only had one table how would they align in columns?
-
Im nearing the completion of a website but have noticed that the tables under 'Linux emulators' on http://www.emulators.cc/ are slightly to the left on the 2-4 columns... compared to the tables above.
How can I fix this? ???
-
any ideas? im still stuck with this.
-
I have double checked and it works fine, although if I type in 2 records it shows this: -
"Error
Column 'version' in field list is ambiguous
select version, os, platform, details from windows_genesis, mac_atari2600 where emulator LIKE '%gens%' OR platform LIKE '%gens%' order by platform asc, emulator asc"
How would I get around that? Surely searching through multiple tables is a regular thing to do when making a search script?
-
Hi, I have been trying to search multiple tables in my database (I have 60+ tables in one database) for records that are LIKE what the user has typed into a search box.
I have generated a table list using SHOW TABLES, I am struggling on the last part to display the results, the area that I need help with is the PHP code which starts with 'if (isset($_POST['emusearch']) && strlen(trim($_POST['emusearch'])) > 0)'
I am trying to use 'show tables' in the row[0] 'select emulator, version, os, platform, details from ".$row[0]." in $search_query, see the third RED php section in the code below.
The error which occurs in the browser when trying to run is:
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 'where emulator LIKE '%stella%' OR platform LIKE '%stella%' order by platform asc' at line 1
select emulator, version, os, platform, details from where emulator LIKE '%stella%' OR platform LIKE '%stella%' order by platform asc, emulator asc
Full page code is: -
<? include($_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'); include($_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnect.php'); if (empty($_POST['emusearch'])) { echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>"; exit(); } else { $query = mysql_query('show tables'); $result = $query or die(mysql_error()); $searchresults = array(); while($row = mysql_fetch_array($result)){ $search_query = "select emulator, version, os, platform, details from ".$row[0]." where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc"; $search = mysql_query($search_query); while ($row2 = mysql_fetch_assoc($search)) { // new $searchresults[] = $row2; // new } // new } if(count($searchresults) < 1) { echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>"; exit(); } else { } } ?> <table width="600" border="0"> <tr> <td> <table width=600 border=0 cellpadding=0 cellspacing=0> <tr> <td> <img src="/images/searchresults.jpg" width=300 height=30 alt="Search Results"></td> <td> <table border="0" cellpadding="0" cellspacing="0" width="290" height="30" background="/images/barmid.jpg"> <tr> <td> <div align="right"> <? echo "<span class='footer'>"; echo $num_rows; echo " "; echo $_POST['emusearch']; if ($num_rows == "1") { echo " emulator found</span>"; } else { echo " emulators found</span>"; } ?> </div></td> </tr> </table> </td> <td> <img src="/images/barend.jpg" width=10 height=30 alt="Search Results"></td> </tr> </table> </td> </tr> <tr> <td><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr class="tablehead"> <td width="240">Emulator</td> <td width="120">Version</td> <td width="120">OS</td> <td width="120">Platform</td> <td width="120">Details</td> </tr> <? if (isset($_POST['emusearch']) && strlen(trim($_POST['emusearch'])) > 0) { $search_query = "select emulator, version, os, platform, details from ".$row[0]." where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc"; if(!$rs = mysql_query($search_query)) { echo "Error<br>".mysql_error()."<br>".$search_query; exit(); } else { $num_rows = mysql_num_rows($rs); while ($emulators = mysql_fetch_row($rs)) { echo "<tr>"; foreach ($emulators as $field) { echo "<td>$field</td>\n"; } echo "</tr>\n"; } } } ?> </table> </table> <? require_once('includes/search.php'); require_once('includes/foot.php'); ?>
-
thanks! this maybe the wrong place to ask but does anyone have any idea on how i could implement that code into the following code where the from ".$query1." part is? im trying to do this to search all tables in my database: -
<?
include($_SERVER['DOCUMENT_ROOT'] . '/includes/head.php');
include($_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnect.php');
$query1 = mysql_query('show tables');
$search_query = "select emulator, version, os, platform, details from ".$query1." where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc";
if (empty($_POST['emusearch']))
{
echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>";
exit();
}
else
{
$search = mysql_query($search_query);
$num_rows = mysql_num_rows($search);
if($num_rows < 1)
{
echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>";
exit();
}
}
?>
-
I have the following code which displays all of the tables in my database with a comma in between each, e.g. "table1, table2, " the problem is that the last comma needs to be removed, I have looked into this and have been told about rtrim or implode functions, although ive tried both in my code with no joy, the following is my code using rtrim which still displays the last comma...
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnect.php');
$query = mysql_query('show tables');
$result = $query or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row[0],", ";
$row[0] = rtrim( $row[0],", ");
}
?>
-
I want all the tables in the database... as I want to search every table for specific information, how can I do that?
-
toonmariner ive tried to do that, then i get this error: -
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/irrm3a/public_html/search.php on line 15
This is the full code: -
<? include($_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'); include($_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnect.php'); $query1 = mysql_query('show tables'); $search_query = "select emulator, version, os, platform, details from '$query1' where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc"; if (empty($_POST['emusearch'])) { echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>"; exit(); } else { $search = mysql_query($search_query); $num_rows = mysql_num_rows($search); if($num_rows < 1) { echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>"; exit(); } } ?>
-
$query1 = mysql_query('show tables');
$search_query = "select emulator, version, os, platform, details from "$query1" where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc";
Im trying to show all tables in 'query1': -
Parse error: syntax error, unexpected T_VARIABLE in /home/irrm3a/public_html/search.php on line 5
-
MySQL said:
#1064 - 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 '* WHERE os = 'windows'' at line 1
-
I have a database containing 40+ tables (and counting), Im looking for the code to do a row count for all the records in every table of the database which contain 'windows' in the field 'os'?
-
<input name="emusearch" type="text" value="e.g. Stella or Atari 2600" onblur="if(this.value=='') this.value='e.g. Stella or Atari 2600';">
I search 'stella' and it returned a result the result of your search will be an issue with the search script - this js for controlling the default value won't affetc it...
How do i make it so that when I click into the box all the default text disappears? at the moment you have to delete it yourself.
-
Hi, ive tried inserting that code but now my search won't find the results.
Try typing 'stella' into the top search box @ http://www.emulators.cc/
-
Hi,
I have a text box which contains a default value which disappears when a user clicks into it to type something: -
<form method="post" action="/search.php" onsubmit="return dis(this)"> <a href="/"><strong>Home</strong></a><strong> | <a href="/about.php#bookmark">Bookmark Us</a> | Find Emulator:</strong> <input name="emusearch" type="text" value="e.g. Stella or Atari 2600" onfocus="if(this.value==this.defaultValue) this.value='';"> <input type="submit" value="Go"> </form>
What code do I need to use to make it so that if the user clicks out of the box it displays the 'e.g. Stella' again?
I know its something to do with default value... but can'tfind the code to use.
Thanks.
-
What is the code to count all records in tables with the table name beginning with 'windows_'?
I have tables beginning with 'windows_' 'mac_' and 'linux_'. -
[code]
<?
include($_SERVER['DOCUMENT_ROOT'] . '/includes/head.php');
include($_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnect.php');
$search_query = "select emulator, version, os, platform, details from windows_atari2600 where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc";
if (empty($_POST['emusearch']))
{
echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>";
exit();
}
else
{
$search = mysql_query($search_query);
$num_rows = mysql_num_rows($search);
if($num_rows < 1)
{
echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>";
exit();
}
}
?>
[/code]
Do I need to use an else statement after the ' if($num_rows < 1) ' in the else call for if (empty($_POST['emusearch'])) -
-
What am I doing wrong with this code? When the if statement is used it still displays the else <title> too.
[code]
<?
$url = $_SERVER['REQUEST_URI'];
if($url == '/')
{
echo "<title>emulators.cc - ";
echo $num_rows;
echo " console and handheld emulators for Windows, Mac and Linux computers";
echo "</title>";
}
if(strpos($url, "about")!== false)
{
echo "<title>emulators.cc > About Us</title>";
}
if(strpos($url, "search")!== false)
{
echo "<title>emulators.cc > Search results for ";
echo $_POST['emusearch'];
echo " (";
echo $num_rows;
echo ")";
echo "</title>";
}
if(strpos($url, "windows")!== false)
{
echo "<title>emulators.cc > Windows Emulators > ";
echo $platform['platform'];
echo " (";
echo $num_rows;
echo ")";
echo "</title>";
}
if(strpos($url, "mac")!== false)
{
echo "<title>emulators.cc > Mac Emulators > ";
echo $platform['platform'];
echo " (";
echo $num_rows;
echo ")";
echo "</title>";
}
if(strpos($url, "linux")!== false)
{
echo "<title>emulators.cc > Linux Emulators > ";
echo $platform['platform'];
echo " (";
echo $num_rows;
echo ")";
echo "</title>";
}
else
{
echo "<title>emulators.cc - console and handheld emulators for Windows, Mac and Linux computers</title>";
}
?>
[/code] -
Thanks! where am I using too much code? if you mean the tables under the emulator headings, how would I do this with less code?
-
Can anyone see a reason why on my website @ http://www.emulators.cc/ that the sliced table which contains the words '8 emulators in this category' isnt displaying correctly in Firefox? Its works fine in IE7 and Apple Safari.
Thanks in advance.
basic record display problems
in PHP Coding Help
Posted
Trying to show results of address details from my database.
But the if statement for 'if there is no result' isnt working... its just displaying 'no recordno recordno record '
I want this to skip if there is no result (using the 'no record' as test text)
Also how can I skip showing a detail, such as 'echo "$addressline2<br>";' if there is nothing in that field on the database?
For the page click here