Helpful Information
Category: vB4 Programming Discussions
Can't get my php to work

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.


Why does not respect the vB method in dealing with your own codes ?

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);

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:

and here is the editing page currently look.

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.

php updated.

Please check my submit form for me. Thanks

You have the forum in the php and in the templates? If so, that is why it is showing up twice.