| Welcome to Webforumz.com. |
|
Apr 30th, 2008, 18:23
|
#21 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
|
Re: Basic database to call information
Thank you, I looked through but didnt see that one! Im still having problems with it, when I click search it now goes to a blank page. If i check source its blank.
|
|
|
Apr 30th, 2008, 19:19
|
#22 (permalink)
|
Join Date: Jun 2007
Location: uk
Posts: 459
|
Re: Basic database to call information
Are you certain you are saving the file as search.php, if not you will have to change the form action from
- HTML: Select all
action="search.php?action=search"
to
- HTML: Select all
action="yourfilename.php?action=search"
Pat
|
|
|
Apr 30th, 2008, 19:37
|
#23 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
|
Re: Basic database to call information
I made sure the file was saved as search.php.
I have looked through the file for errors I have made when changing information but couldnt see any. 
|
|
|
Apr 30th, 2008, 19:42
|
#24 (permalink)
|
Join Date: Jun 2007
Location: uk
Posts: 459
|
Re: Basic database to call information
Can you post your entire code again.
I dowloaded Bronic's code and it worked for me.
It's probably something very simple.
Are you using dreamweaver by the way
|
|
|
Apr 30th, 2008, 19:47
|
#25 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
|
Re: Basic database to call information
Thanks for looking
Im using notepad.
- Code: Select all
<?php
if($_GET['action'] == "search") {
$var = $_POST['q'] ;
$trimmed = trim($var);
$host = "localhost";
$db = "database";
$usr = "user";
$pss = "password";
$limit=1;
if (!$trimmed)
{
echo "<p>Please enter the 10 digit Member ID</p>";
exit;
}
if (!isset($var))
{
echo "<p>You MUST enter the 10 digit Member ID</p>";
exit;
}
mysql_connect($host,$usr,$pss);
mysql_select_db($db) or die("Unable to select database");
$query = "select * from users where fldID = '$trimmed' order by fldID";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
if ($numrows == 0)
{
echo "<h4>Search</h4>";
echo "<p>Member ID: "" . $trimmed . "" is NOT valid</p>";
if (empty($s)) {
$s=0;
}
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
echo "<p>Member ID: "" . $var . ""</p>";
echo "Member Name";
while ($row= mysql_fetch_array($result)) {
$Name = $row["fldName"];
$address = $row["fldAddress"];
$Id = $row["fldExp"];
$status = $row["fldStatus"];
echo "$count: $Name<br>Id Number: $Id<br>Address: $address<br>Status: $status<br>" ;
$count++ ;
}
$currPage = (($s/$limit) + 1);
echo "<br />";
if ($s>=1) { // bypass PREV link if s is 0
$prevs=($s-$limit);
print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><<
Prev 10</a>  ";
}
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
}
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
$news=$s+$limit;
echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>";
}
$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo "<p>Showing results $b to $a of $numrows</p>";
}
}
?>
|
|
|
Apr 30th, 2008, 20:03
|
#26 (permalink)
|
Join Date: Jun 2007
Location: uk
Posts: 459
|
Re: Basic database to call information
Don't know what to suggest, just tested your code on my server and it seems to be working.
possibly check notepad is saving in ANSI.
|
|
|
Apr 30th, 2008, 20:05
|
#27 (permalink)
|
|
Junior Member
Join Date: Apr 2007
Location: Kansas
Age: 18
Posts: 33
|
Re: Basic database to call information
if you need to use aptana it acts like a debugger and shows you syntax errors in your php and it color codes it.
also could you post the link to the page on your site where it is uploaded so we can see it?
http://www.aptana.com
Last edited by BRONIC; Apr 30th, 2008 at 20:13.
|
|
|
Apr 30th, 2008, 20:38
|
#28 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
|
Re: Basic database to call information
I have made a few changes and now it seems to work, not sure what i was doing wrong,
|
|
|
Apr 30th, 2008, 20:39
|
#29 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
|
Re: Basic database to call information
Sorry, forgot to say - Thank you very much for your help. Is it possible to keep this thread open?
|
|
|
May 1st, 2008, 04:46
|
#30 (permalink)
|
|
Junior Member
Join Date: Apr 2007
Location: Kansas
Age: 18
Posts: 33
|
Re: Basic database to call information
You are very welcome.
Im not sure if the moderators will keep it open but if you need anymore help you can pm or email me.
|
|
|
May 1st, 2008, 09:29
|
#31 (permalink)
|
|
Chief Moderator
Join Date: Oct 2007
Location: UK
Posts: 701
|
Re: Basic database to call information
Pretty much all threads are kept open - we may mark them as 'SOLVED', but users can always add to it 
__________________
|
|
|
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|