Jump to content

Codeshare admin module


Strider

Recommended Posts

As some of you have seen in my post in the va section, I have a codeshare module. It at the time did not have an admin side thus I had to add all the codeshares in manually. I have now since created a module, using Simpilots events as a base but edited to add in new codeshare routes. The adding of the codeshares works a dream, it adds the new route into the codeshare table and all. But the main view where you should see the ones currently in the db do not show. And I cant for the life of me work out why. I have switched the way the if else statement looks at it and it just gives me an error, saying an invalid argument supplied for foreach.

<?php
$this->show('codeshare/codeshare_header.tpl');

echo 'Click On Codeshare For Details/Editing<hr />';

echo '<h4>Codeshares</h4><hr />';
   if(!$codeshare)
   {
  echo '<table width="100%">';
   echo '<tr><td width="30%"><u>Schedule ID</u></td><td width="60%"><u>Airline</u></td></tr>';

   foreach($codeshare as $codeshares)
   {
    echo '<tr><td><a href="'.SITE_URL.'/admin/index.php/CodeShare_admin/get_codeshare?id='.$codeshares->id.'">'.$codeshares->schedid.'</a></td>';
    echo '<td>'.$codeshares->airline.'</td></tr>';
   }

   echo '</table>';
   }
   else
   {
         echo 'No Codeshares found';
   }

?>   

There is the code from the index page of the module.

  • Like 2
Link to comment
Share on other sites

have a problem importing the sql

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''image' varchar(255) NOT NULL,

PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHA' at line 5

CREATE TABLE IF NOT EXISTS `phpvms_codeshares` (

`id` int( 11 ) NOT NULL AUTO_INCREMENT ,

`schedid` int( 11 ) NOT NULL ,

`airline` varchar( 50 ) NOT NULL ,

'image'varchar( 255 ) NOT NULL ,

PRIMARY KEY ( `id` )

) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =28;

I solved it by manually creating the table dont know why it did not work to import the via mysql import option

Link to comment
Share on other sites

  • 2 weeks later...

hmmm, not sure, this happened with jet2 virtual, they installed it, I even installed it, but it did not work for them. And I do not know why. It is the same code that works for others who say it works for them. Do any errors show up for you?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...