[PHP-DB] Re: SQL query error

2007-02-20 Thread Haydar Tuna
Hello,
Do you check the how many rows return. You can display rows count 
with following PHP code. If rows count is zero, you can see the blank page. 
:)

$num_rows = mysql_num_rows($result);
echo ($num_rows);


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

"Chris Carter" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> What wrong with this syntax, its not giving any error on runtime but I am
> facing a blank page while paging.
>
> $query=" SELECT * FROM gurgaonmalls WHERE mallname = '$mallname' limit 
> $eu,
> $limit ";
> -- 
> View this message in context: 
> http://www.nabble.com/SQL-query-error-tf2831052.html#a7903857
> Sent from the Php - Database mailing list archive at Nabble.com. 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: SQL Query - Using variable from another SQL Query

2007-02-12 Thread Mike Morris

I think you don't need to break this into two queries... this is really a SQL 
question, 
not a PHP question... 

Just do a "join" on the two tables:
*   where table1.cal_id = table2.cal_id

and then have a where clause that does all your filtering:

*   and table1.Date > now() and table2.cal_category='501' 


Using SQL instead of code is almost always the right thing to do. Learning how 
to 
do more sophisticated queries will pay off big time in the long run... and good 
tutorials are widely and freely available...



From:   "Matthew Ferry" <[EMAIL PROTECTED]>
To: 
Date sent:  Mon, 12 Feb 2007 11:14:32 -0500
Subject:SQL Query - Using variable from another SQL Query

> Hello Everyone
> 
> Got a simple / stupid question.
> Worked on this all night. I'm over looking something very basic here.
> 
> The query "event_time" brings back the calendar id for each event that is 
> pending in the future.
> ie 12, 13, 14, 26  (There could be 100 of them out there)
> 
> The second query "events" needs to meet both reqirements.  
>  1 - cal_category='501' 
>  2 - cal_id= a number from the "event_time" query
> 
> I think i need to do a loop inside of a loop
> 
> Thanks...
> 
> Matt 
> 
> 
> Here is my code: 
> 
>  
> $todays_year = date("Y");
> 
> $todays_month = date("m");
> 
> $todays_day = date("d");
> 
> $tstamp = mktime(0, 0, 0, $todays_month, $todays_day, $todays_year);
> 
> $event_time = mysql_query("SELECT cal_id FROM egw_cal_dates where cal_start > 
> $tstamp", $db);
> 
> $events = mysql_query("SELECT * FROM egw_cal WHERE cal_category='501' and 
> cal_id='$event_time'\n", $db);
> 
> 
> 
> if ($event = mysql_fetch_array($events)) {
> 
> echo "\n";
> 
> echo "\n";
> 
> do {
> 
> echo " Size='10'>$event[cal_title]-   $event[cal_location]\n";
> 
> echo "\n";
> 
> echo "$event[cal_description]";
> 
> echo "\n";
> 
> echo "\n";
> 
> } while ($event = mysql_fetch_array($events));
> 
> } else {
> 
> echo "No Public Events Are Currently Scheduled...";
> 
> }
> 
> ?>
> 
> 




[PHP-DB] Re: SQL query error

2006-12-16 Thread Geoff Lane
On Saturday, December 16, 2006, Jeffrey wrote;

> Have you tried...

> echo " $query ";

> ...to unsure the variables have the values you expect them to have?
---

Another thing to try (particularly with SELECT statements) is to cut
and paste the echoed query from your browser to the DBMS prompt (e.g.
MySQL prompt or MSSQL Query Analyser), attempt to run it, and then
follow up any errors the DBMS reports.

HTH,

-- 
Geoff


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: sql query, editing?

2004-01-15 Thread Justin Patrin
Louie Miranda wrote:

I have this code below, it fetches data on a mysql database. I was hoping
you could give me a code hint on where could, my goal is to display this
data on a browser which i did already and be able to edit it via a form.
edit? -> table1=value -> table2=value

I dont know where to start. please help me, i hope i can display all the
data and have a button for editing and catch which one to edit.
Well, my first suggestion is to use a database abstraction class such as 
PEAR's DB. It offers much more powerful features than the regular mysql 
extension in PHP, has better error handling, and allows you to have the 
same interface for all of the databases it supports.

My second suggestion is to use DB_DataObject and 
DB_DataObject_FormBuilder to create the forms for a table and handle 
editing the data. It really simplifies things.

My third suggestion would be to use a new package that I'm writing. It 
not only automates editing of table data, but it also shows you all of 
the records and lets you view multiple tables. Unfortunately, it's not 
out yet, but I could give you a copy if you wanted. To see the precursor 
to what I'm working on, check out RDBEdit (http://rdbedit.sf.net).

PEAR::DB http://pear.php.net/package/DB
PEAR::DB_DataObject http://pear.php.net/package/DB_DataObject
PEAR::DB_DataObject_FormBuilder 
http://pear.php.net/package/DB_DataObject_FormBuilder

--
paperCrane 
--
Question Everything, Reject Nothing
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: sql query

2003-11-25 Thread pete M
got round the problem like this
select distinct(to_days(date_file_created)), date_file_created from files
Pete M wrote:

why does this

select date(date_file_created) from files

create the error
error near  near '(date_file_created) from files' at line 1
trying to extract the date part of the date_tile filed

tia
pete
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php