Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Edited PHP script- But not working? HELP!
Old 12-05-2007, 06:56 PM Edited PHP script- But not working? HELP!
coldturkey's Avatar
Extreme Talker

Posts: 211
Name: Rachel
Location: Spain
Trades: 3
I have edited a PHP script - but obviously not very well as it wont work - can any one help?
This is the code - I am just trying to get the info out the data base and on the page - nothing fancy:

PHP Code:
<?php
mysql_connect
("localhost""axarquia_axarquia""Paco123")OR DIE (mysql_error());
mysql_select_db("axarquia_properties")OR DIE (mysql_error());
$num_results_per_page 10;
$start_offset 0;
$current_page 1;
if (
$_GET['page'] > 0) {
  
$current_page = (int)$_GET['page'];
  
$start_offset = ($current_page-1)*$num_results_per_page;
}
$results mysql_query("select SQL_CALC_FOUND_ROWS letra,tipo,extras,1_dia,2_dias,3_dias,4_dias,5_dias,6_dias,7_dias from car_hire order by Date DESC limit ".$start_offset.",".$num_results_per_page);
echo 
'<h3><?php echo $content_rent_car; ?></h3>';
if (
$results && mysql_num_rows($results) > 0) {
     echo 
'</div>';
  while(
$a_result mysql_fetch_assoc($results)) {
    echo 
'
 <table><tr><td></td><td>Type of Car</td><td>1 Day</td><td>2 Days</td><td>3 Days</td><td>4 Days</td><td>5 Days</td><td>6 Days</td><td>7 Days</td></tr>
<tr><td>'
.$a_result['letra'].'</td><td>'.$a_result['tipo'].'</td><td>'.$a_result['extras'].'</td><td>'.$a_result['1_dia'].'</td><td>'.$a_result['2_dias'].'</td><td>'.$a_result['3_dias'].'</td><td>'.$a_result['4_dias'].'</td><td>'.$a_result['5_dias'].'</td><td>'.$a_result['6_dias'].'</td><td>'.$a_result['7_dias'].'</tr></table>
'
;
   }
 
     echo 
'</div>';
   }
?>
Please help if you can see a error
Thanks

__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

coldturkey is offline
Reply With Quote
View Public Profile Visit coldturkey's homepage!
 
 
Register now for full access!
Old 12-05-2007, 08:52 PM Re: Edited PHP script- But not working? HELP!
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
What error message are you getting? I don't catch anything at first glance other than some questionable formatting (I'm a formatting nazi). There might be something wrong with you sql query considering that there are no quotes around any of your values, but I may be wrong.

If you give me your error message I should be able to pick out the error... Or someone with a better eye than me will come by and pick it out before you get a chance.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 12-06-2007, 05:01 AM Re: Edited PHP script- But not working? HELP!
coldturkey's Avatar
Extreme Talker

Posts: 211
Name: Rachel
Location: Spain
Trades: 3
It doesnt come up with an error - just doesnt work! - Ive no idea!
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

coldturkey is offline
Reply With Quote
View Public Profile Visit coldturkey's homepage!
 
Old 12-06-2007, 05:29 AM Re: Edited PHP script- But not working? HELP!
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
If it was me i'd cut it down to a basic query that works and build it back up again.
PHP Code:
<?php
mysql_connect
("localhost""axarquia_axarquia""Paco123")or die (mysql_error());
mysql_select_db("axarquia_properties")or die (mysql_error());

$results mysql_query("select letra,tipo,extras,1_dia,2_dias,3_dias,4_dias,5_dias,6_dias,7_dias from car_hire order by Date");

if (
mysql_num_rows($results) > 0) {
     echo 
'</div>';
  while(
$a_result mysql_fetch_assoc($results)) {
    echo 
'
 <table><tr><td></td><td>Type of Car</td><td>1 Day</td><td>2 Days</td><td>3 Days</td><td>4 Days</td><td>5 Days</td><td>6 Days</td><td>7 Days</td></tr>
<tr><td>'
.$a_result['letra'].'</td><td>'.$a_result['tipo'].'</td><td>'.$a_result['extras'].'</td><td>'.$a_result['1_dia'].'</td><td>'.$a_result['2_dias'].'</td><td>'.$a_result['3_dias'].'</td><td>'.$a_result['4_dias'].'</td><td>'.$a_result['5_dias'].'</td><td>'.$a_result['6_dias'].'</td><td>'.$a_result['7_dias'].'</tr></table>
'
;
   }
 
     echo 
'</div>';
   }
?>
You need to echo out all your variables to see whats going on - almost certainly the select statement and your quotes. Try using
<?php echo "<pre>"; print_r($GLOBALS) ?>

at end of script.
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 12-06-2007, 08:03 PM Re: Edited PHP script- But not working? HELP!
shivaji's Avatar
Ultra Talker

Posts: 318
Trades: 0
I don't understand this line:

Quote:
echo '<h3><?php echo $content_rent_car; ?></h3>';
I think right is:
Quote:
echo "<h3>$content_rent_car</h3>";
Shivaji
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 12-08-2007, 06:44 AM Re: Edited PHP script- But not working? HELP!
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
Trades: 0
Have you got an error log:
- standard local error logs on your PC (if you are running this on a dev server) are in the PHP folder errorlog.txt or similar
- on your web admin bit of your hosting

The error might be recorded in there and it would help. Shijavi is right as well.
__________________
Foundation Flash tutorials :
Please login or register to view this content. Registration is FREE


New Dreamed Up Web Design:
Please login or register to view this content. Registration is FREE
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Reply     « Reply to Edited PHP script- But not working? HELP!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51806 seconds with 12 queries