conveting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

if you're using PHPMyAdmin, click on the table name, go to export, uncheck the data field, click go, and it'll give you the table structure in plain text ;)
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

oh, no i see,

Code: Select all

-- phpMyAdmin SQL Dump
-- version 2.6.4-pl2
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Mar 07, 2006 at 07:36 AM
-- Server version: 4.0.25
-- PHP Version: 4.3.11
-- 
-- Database: `gaogier_site`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `skill`
-- 

CREATE TABLE `skill` (
  `id` int(10) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `added` int(11) NOT NULL default '0',
  `guideby` varchar(30) NOT NULL default '',
  `contributors` varchar(225) NOT NULL default '',
  `members` char(1) NOT NULL default 'N',
  `mainbody` text NOT NULL,
  `updated` int(11) NOT NULL default '0',
  `sorter` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

and skills?
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

that is skills, you also want quests?

its going to be different
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

no, that's skill. You have a reference to skills as well.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

he wants the CREATE TABLE not the select from table. to get that goto phpadmin (is that what its called?) or whatever you use to edit and create your tables and do a dump of the sql
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

i worked out how to fix that problem, i now have to fix this

This skill guide was written by Gaogier for use on Runehints and entered into the database on Thursday 1st of January 1970 @ 01:00:00 . No-one has updated this skill guide. No-one else has contributed to this Skill guide.

and the title dose not show
septer 1
Forum Newbie
Posts: 2
Joined: Mon Mar 06, 2006 1:05 pm

Post by septer 1 »

how do you get the time and date woking on the page?
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

why is the date wrong? how can i set it up so its correct?

the php code:

Code: Select all

<?php
include('header.inc');
?>
<?

function skillview($id) {


require_once ('../mysql_connect.php');//connect to db
 /* query for item */
    $query = "SELECT * FROM skill WHERE id=$id";
    $result = mysql_query ($query);
    
    /* if we get no results back, error out */
$numrtn = mysql_num_rows($result);

    if ($numrtn == 0) {
        echo "The Skill guide requested cannot be found\n";
        echo $id;
        return;
    }
    $row = mysql_fetch_assoc($result);
    /* easier to read variables and 
     * striping out tags */
    $id = $row['id'];
    $name = $row['name'];
    $contributors = $row['contributors'];
    $guideby = $row['guideby'];
    $added = $row['added'];
    $members = $row['members'];
        $guide = $row['mainbody'];
    $updated = $row['updated'];
    if ($members == "Y") {
        $mem = "members only Skill</b>, so it can only be done on a <b>members</b> server.";
    }else{
        $mem = "non-members Skill</b>.";
    }
    if ($updated == 0){
    $up = 'No-one has updated this skill guide';    
    }else{    
    $date2 = date("l jS of F Y @ H:i:s ", $updated);
    $up = 'It was last updated on '.$date2;
    }
    if ($contributors != ""){
    $con = 'Thanks also to <b>'.$contributors.'</b> for changes.';    
    }else{
    $con = 'No-one else has contributed to this Skill guide.';
    }
    //$date = date("D M jS, Y g:i a", $added);
    $date = date("l jS of F Y @ H:i:s ", $added);
    
echo '

<div id="skill">
<p><span class="skillheader"><center>'.$name.'</center></span></p>
<p class="text">This skill guide was written by <b>'.$guideby.'</b> for use on Runehints and entered into the database on '.$date.'. '.$up.'. '.$con.'  <br /></p>
<p><span class="text"><br />This skill is <b>'.$mem.'</span></p>
<p>
  <p><span class="qtitles">Skill Guide:</span></p>
  <span class="text">
  <p>'.$guide.'</p>
  </span>

  </div> ';
}

function selectskill(){

require_once ('../mysql_connect.php');//connect to db
global $sitestyle;
    ?>
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td bgcolor="#000000" align="center" border="0" cellpadding="0" cellspacing="0" valign="top">
    
    
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td background="images/<?php echo $sitestyle.'_'; ?>tabletopl.jpg" height="25" width="30"></td>
          <td background="images/<?php echo $sitestyle.'_'; ?>tabletopm.jpg" height="25"><div align="center"><font class="text"><b>Non-member's Skills</b></font></div></td>
          <td background="images/<?php echo $sitestyle.'_'; ?>tabletopr.jpg" height="25" width="30"></td>
           </tr>
      </table>
             <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td background="images/<?php echo $sitestyle.'_'; ?>tablemidl.jpg" width="16"></td>
          <td bgcolor="#000000" align="left" border="0" cellpadding="0" cellspacing="0">
          <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <?php
          
              /* query for skills */
        $n_query = "SELECT id, name, guideby, members, sorter FROM skill WHERE members='n' ORDER BY sorter ASC";
    
        $n_result = mysql_query ($n_query);
        while ($n_row = mysql_fetch_assoc($n_result)) {
        $n_name = $n_row['name'];  
        $n_guideby = $n_row['guideby'];
        $id = $n_row['id'];
        /* place table row data in 
         * easier to use variables.
         * & display the data */
       echo '<tr><td width=100%><b><a href="skills.php?flibble=skillview&id='.$id.'&ic=1">'.$n_name.'</a></b></td><td><font class=small>'.$n_guideby.'</font></td></tr>'; 
    }
        /* finish up table*/
        ?>
        </table>
        </td>
          <td background="images/<?php echo $sitestyle.'_'; ?>tablemidr.jpg" width="16"></td>
          </tr>
          </table>
      
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
                          <td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottoml.jpg" height="13" width="16"></td>
                          <td background="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13" width="1"></td>
                          <td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomr.jpg" height="13" width="16"></td>
        </tr>
      </table>
    </td>  
    
    <td width="16"></td>
    
    <td bgcolor="#000000" align="center" border="0" cellpadding="0" cellspacing="0" valign="top">
    
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td background="images/<?php echo $sitestyle.'_'; ?>tabletopl.jpg" height="25" width="30"></td>
          <td background="images/<?php echo $sitestyle.'_'; ?>tabletopm.jpg" height="25"><div align="center"><font class="text"><b>Member's Skills</b></font></div></td>
          <td background="images/<?php echo $sitestyle.'_'; ?>tabletopr.jpg" height="25" width="30"></td>
           </tr>
      </table>
             <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td background="images/<?php echo $sitestyle.'_'; ?>tablemidl.jpg" width="16"></td>
          <td bgcolor="#000000" align="left" border="0" cellpadding="0" cellspacing="0">
          <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <?php

    /* query for skills */
        $y_query = "SELECT id, name, guideby, members, sorter FROM skill WHERE members='y' ORDER BY sorter ASC";
    
        $y_result = mysql_query ($y_query);
        while ($y_row = mysql_fetch_assoc($y_result)) {
        $y_name = $y_row['name'];  
        $y_guideby = $y_row['guideby'];
        $id = $y_row['id'];
        /* place table row data in 
         * easier to use variables.
         * & display the data */

        echo '<tr><td width=100%><b><a href="skills.php?flibble=skillview&id='.$yid.'&ic=1">'.$y_name.'</a></b></td><td><font class=small>'.$y_guideby.'</font><br /></td></tr>'; 
}

        /* finish up table*/?>
        </table>    
        </td>
          <td background="images/<?php echo $sitestyle.'_'; ?>tablemidr.jpg" width="16"></td>
          </tr>
          </table>
      
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
                          <td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottoml.jpg" height="13" width="16"></td>
                          <td background="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13" width="1"></td>
                          <td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomr.jpg" height="13" width="16"></td>
        </tr>
      </table>
      
      
            </td></tr></table>
          <?php
    }
    
    
    switch($_GET['flibble']) {
    
    case 'selectskill':
        selectskill();
        break;
    case 'skillview':
        skillview($_GET['id']);
        break;        
    default:
        selectskill();
}
    
include('footer.inc');
    ?>
Last edited by gaogier on Fri Mar 10, 2006 2:12 pm, edited 1 time in total.
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

Check out the date function from the PHP manual. It tells you exactly what each letter represents. Use this as a guide to customise it to your needs.
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

the date show up as i want, but it is Thursday 1st of January 1970 @ 01:00:00
Post Reply