BetaONE will rise again!


Reply
  #1  
Old 21st May 04, 08:30 PM
JacKDynne's Avatar
JacKDynne JacKDynne is offline
Administrator
 
Join Date: Oct 2001
Location: The Past Through Tomorrow
Posts: 1,591
JacKDynne will become famous soon enoughJacKDynne will become famous soon enough
Send a message via MSN to JacKDynne
Ok goes like this:

I have a php/mysql app that captures telephone calls via user entry, all works fine except for this - when users check to see if the caller has called before there is a query that lists previous callers by using this query:
Code:
$query = mysql_query("select `FirstName` , `LastName` from tracker ORDER BY `FirstName`") or die(mysql_error());
which when run directly against the db in mysql returns everything fine but when returned to the web page that calls it in php will not list those with the same last name or first name, depending on how I structure the query.

Here is the complete code (in the order that it's called):

viewclient.php


Code:
<? session_start(); header("Cache-control: private"); if ($_SESSION["loggedin"] != 1) { echo "Please login before trying to access this script."; exit(); } require("include/config.php"); include("templates/header.php"); $connection = mysql_connect ($host, $user, $pass) or die(mysql_error()); mysql_select_db ($db) or die (mysql_error()); $query = mysql_query("select `FirstName` , `LastName` from tracker ORDER BY `FirstName`") or die(mysql_error()); echo "<form name='frmClient' method='post' action='clientid.php'>"; echo "<table><tr><td class='formleft'>Please select a client:</td>"; echo "<td class='formright'><select name='client'>"; while ($line = mysql_fetch_row($query)) { if ($prev != $line[0] && $prev2 != $line[1]) { &nbsp;$line[0] = str_replace("\\","",$line[0]); &nbsp;echo "<option>" . $line[0] . " " . $line[1] . "</option>"; } $prev = $line[0]; $prev2 = $line[1]; } echo "</select></td></tr><tr><td class='formleft'>&nbsp;</td><td class='formright'>"; echo "<input type='submit' />&nbsp;<input type='reset' /></td></tr></table>"; include("templates/resultsfoot.php");
clientid.php:
Code:
<? session_start(); header("Cache-control: private"); if ($_SESSION["loggedin"] != 1) { echo "Please login before trying to access this script."; exit(); } require("include/config.php"); include("templates/header.php"); $connection = mysql_connect ($host, $user, $pass) or die(mysql_error()); mysql_select_db ($db) or die (mysql_error()); $names = explode(" ",$client); $query = mysql_query("select `index` , `Screening` from tracker WHERE `FirstName` = '$names[0]' AND &nbsp;`LastName` = '$names[1]' ORDER BY `index`") or die(mysql_error()); echo "<form name='frmClient' method='post' action='reports/client.php'>"; echo "<table><tr><td class='formleft'>Please select a call number:</td>"; echo "<td class='formright'><select name='callnumber'>"; while ($line = mysql_fetch_row($query)) { if ($prev != $line[0]) { &nbsp;$line[0] = str_replace("\\","",$line[0]); &nbsp;echo "<option>" . $line[0] . " Date entered: " . $line[1] . "</option>"; } $prev = $line[0]; } echo "</select></td></tr><tr><td class='formleft'>&nbsp;</td><td class='formright'>"; echo "<input type='submit' />&nbsp;<input type='reset' /></td></tr></table>"; include("templates/resultsfoot.php"); ?>
client.php:
Code:
<? ob_start("ob_gzhandler"); session_start(); header("Cache-control: private"); if ($_SESSION["loggedin"] != 1) { echo "Please login before trying to access this script."; exit(); } require("../include/config.php"); echo "<html style='overflow-x: hide'>\n<head>\n<title>\nWID Call Tracking\n</title>\n<link rel='stylesheet' type='text/css' href='../stylesheet/style.css' />\n</head>\n<body>\n<img src='../images/header.jpg' alt='' />\n<hr style='color: black; height: 1px' />\n"; $connection = mysql_connect ($host, $user, $pass) or die(mysql_error()); mysql_select_db ($db) or die (mysql_error()); $id = explode(" ",$callnumber); $query = mysql_query("select * from tracker WHERE `index` = '$id[0]'") or die(mysql_error()); $results = mysql_fetch_array($query) or die(mysql_error()); $index = 0; $cquery = mysql_query("select count(*) from descriptions") or die(mysql_error()); $count = mysql_result($cquery, 0); while($index != $count) { $results[$index] = str_replace("\\","",$results[$index]); $index = $index + 1; } echo "<table width='725' style='height: 70%' align='left'>\n"; $index2 = 1; $query2 = mysql_query("select `desc` from descriptions") or die(mysql_error()); while ($line = mysql_fetch_row($query2)) { $line[0] = str_replace("\\","",$line[0]); echo "\n<tr>\n<td class='formleft'>\n" . $line[0] . "\n</td>\n<td class='formright'>"; echo "\n" . $results[$index2] . "\n</td>\n</tr>\n"; $index2 = $index2 + 1; } include("../templates/resultsfoot.php"); ?>
Like I said, when I run the query straight against the db it returns all called just fine but when it's run via the browser it does not return any records that have the same name, depending on the ORDER BY order, in this case the firstname.

Any ideas? Puhhhhhhhhllllleeeeeeeeeeeeeeeeeeeeeeeeesssssse?

MUCHO TIA

/JD
__________________


Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WinXP Soundcard problems Camino Hardware Support 5 28th Oct 04 02:28 AM
MySQL Update Puts a Toe Into Big Vendors' Database Turf NewsBot NeoWin News 0 27th Oct 04 09:30 PM
Floppy problems Bads Hardware Support 10 15th Oct 01 12:29 AM
Abit TH7-Raid & Pentium 1.8 Problems.... Tank Hardware Support 8 10th Sep 01 10:38 AM


All times are GMT +1. The time now is 01:51 AM.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.