PDA

View Full Version : Can't get my php to work


vietfancy
23 Nov 2009, 23:59
After upgraded my forum to vb4, my php code seems doesn't work anymore. I tried to rewrite the code, and template, but I.... just got stuck, cant get it to work.

I think i have problem form this line:

if ($ese_schedule['do'] == "edit"){

I attached my php file and a template below this post hoping that you can help me out.

Thanks

xman_79
24 Nov 2009, 08:24
Why does not respect the vB method in dealing with your own codes ?

winstone
24 Nov 2009, 22:43
It is best to tell us what exactly is wrong with your mod and if you are getting any errors
by the way, looking at your code, let's say "$ese_schedule['do'] == 'main'", what exactly is your script suppose to do?
I can't see following variables declared anywhere in your php file

$templater->register('tue', $tue);
$templater->register('wed', $wed);
$templater->register('thu', $thu);
$templater->register('fri', $fri);
$templater->register('sat', $sat);
$templater->register('sun', $sun);

vietfancy
25 Nov 2009, 04:55
I use $mond for the code below to show all classes on monday. and $tue to shows all classes on tuesday... and so on, since the code is too long, i removed tuesday to sunday.

They can get all the classes in schedule just fine. I can also remove and approve classes, but I can't edit them. when I tried to click on edit, they show 2 forms (1 display above header with all $var

$templater->register('mond', $mond);


if ($ese_schedule['do'] == "main"){
// Get Monday
$result = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "schedule WHERE day = 'Monday' AND live = '1' ORDER BY display");
while($mon = $vbulletin->db->fetch_array($result)){
$mond .= "<b><font color='#FF0000'>$mon[display]</font></b> -
<b>$mon[day]</b> -
<b>$mon[time]&nbsp;$mon[ampm]</b> -
<b>$mon[instructor]</b> -
<b>$mon[class]</b> -
<b>$mon[level]</b> -
<b><span><a href='schedulecp.php?do=edit&id=$mon[id]'>Edit</a></span></b> -
<b><span><a href='schedulecp.php?do=approve&id=$mon[id]'>Approve</a></span></b> -
<b><span><a href='schedulecp.php?do=delete&id=$mon[id]'>Delete</a></span></b><br />";
}

// Get tuesday
//code for getting tuesday's classes here using $tue
// Get wednesday
//code for getting tuesday's classes here using $wed
// Get thur
//code for getting tuesday's classes here using $thu
// Get fri
//code for getting tuesday's classes here using $fri
// Get sat
//code for getting tuesday's classes here using $sat
// Get sun
//code for getting tuesday's classes here using $sun

}

here is how the main page looks:
http://www.vbulletin.org/forum/attachment.php?attachmentid=106723&stc=1&d=1259128418

and here is the editing page currently look.
http://www.vbulletin.org/forum/attachment.php?attachmentid=106724&stc=1&d=1259128421

cellarius
25 Nov 2009, 09:59
You need to get rid of all those echo statements in your php. You can't output anything using echo within vB, you need to use a template.

vietfancy
25 Nov 2009, 10:45
php updated.

Please check my submit form for me. Thanks

Lynne
25 Nov 2009, 14:56
You have the forum in the php and in the templates? If so, that is why it is showing up twice.