Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

Click here to join us on IRC (#charas on irc.freenode.net)!



  • Charas-Project »
  • Off-Topic »
  • Archive »
  • Really Old Stuff »
  • PHP (Moderator: De KoFfieŠ) »
  • PHP questions
« previous next »
  • Print
Pages: [1]

Author Topic: PHP questions  (Read 33778 times)

Offline GaryCXJk

  • <strong>Official Charas.EX Team Member</strong>
  • Exemplar
  • *
  • Posts: 1,586
  • FOUR OH FOUR'D
    • Multiverse Works
PHP questions
« on: April 24, 2003, 06:14:18 PM »
I have some questions about PHP.

1) How do you create a table within the PHP script?
2) How was the php tag created (I want to create an own forum)?

Maybe I'll find some more questions.
Logged

Play it now! Charas Breakout DX
Area91: for MUGEN and RPG Maker VX Ace stuff

Offline Alex

  • I am the MASTER!
  • Administrator
  • Exemplar
  • *
  • Posts: 1,130
(No subject)
« Reply #1 on: April 24, 2003, 08:45:00 PM »
1) Example (this will print a 10 cell row with values 1-10 into each):

print '<table><tr>';
for (
$i=1;$i<=10;$i++) {
print 
'<td>'.$i.'</td>';
}
print 
'</tr></table>';

Same, but with 5 cells in 2 rows:

print '<table><tr>';
for (
$i=1;$i<=10;$i++) {
print 
'<td>'.$i.'</td>';
if (
$i==5) print '</tr><tr>';
}
print 
'</tr></table>';


2) I don't understand what do you mean, here....
Maybe how the php tag is written? ( )
Logged

Offline GaryCXJk

  • <strong>Official Charas.EX Team Member</strong>
  • Exemplar
  • *
  • Posts: 1,586
  • FOUR OH FOUR'D
    • Multiverse Works
(No subject)
« Reply #2 on: April 25, 2003, 09:01:07 AM »
1) I actually meant how you could create a MySQL table. is it with the mysql_query() command?

2) I meant this tag:
 
<?php
print("This command, in this forum.")
echo(
$where,$you,$can,$see,$diffrent,$colors)
?>
Or something like that.
[PHP]...[ /PHP]
Logged

Play it now! Charas Breakout DX
Area91: for MUGEN and RPG Maker VX Ace stuff

Offline Alex

  • I am the MASTER!
  • Administrator
  • Exemplar
  • *
  • Posts: 1,130
(No subject)
« Reply #3 on: April 25, 2003, 09:54:27 AM »
Uuuuuuuuuuuups... sorry.....
Table is table, i misunderstood! :D

Yes, mysql_query() is correct. After a mysql_connect(), of course ;)
About the sql syntax needed, give a look here:
http://www.mysql.com/doc/en/CREATE_TABLE.html

About php tag:
the "nw" class is the one with color definitions.


$bericht 
= preg_replace('_\[PHP\](.*?)\[/PHP\]_ise', "highlight(trim(stripslashes(' \\1 ')))", $bericht);

function 
highlight($code){ 
	
ob_start(); 
	
$code = str_replace(" <?", "<?", $code); 
	
$code = str_replace("<br>", "", $code); 
	
$code = str_replace('\\"', '\"', $code); 
	
$code = str_replace("
"
, "", $code); 
	
$code = str_replace("<", "<", $code); 
	
$code = str_replace(">", ">", $code); 
	
$code = str_replace(""", "\"", $code); 
	
$code = str_replace("&", "&", $code); 

	
highlight_string($code); 
	
$code = ob_get_contents(); 
	
ob_end_clean(); 
	

	
$data_lines = explode('
'
,$code);
	
for (
$i=0, $j=count($data_lines); $i < $j; $i++) {
	
	
$k = $i + 1;
	
	
$ret .= '<div class="nw"><code>'.$k.'  </code><span class="c2">'.$data_lines[$i]."</span></div>\n";
	
	
if (
strlen($data_lines[$i]) > 450) {
	
	
	
$ret .= '
'
;
	
	
}
	
}
	

	
$string = "<table border='0' cellpadding='3' cellspacing='1'><tr><td><font face='verdana,arial,helvetica' size='1'><b>PHP Code:</b></font></td></tr><tr><td style='BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #FFFFFF; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #CCCCCC;'>" . $ret . "</td></tr></table>\n\n";
	
return 
$string; 
}
Logged

Offline madskaven1

  • Not sure right now
  • Initiate
  • *
  • Posts: 44
  • 14 Male
(No subject)
« Reply #4 on: April 25, 2003, 10:53:58 PM »
How do open the php file? im new to this stuff. :bend:
Logged

Offline Alex

  • I am the MASTER!
  • Administrator
  • Exemplar
  • *
  • Posts: 1,130
(No subject)
« Reply #5 on: April 26, 2003, 10:37:46 AM »
You need a web server.
Two possile scenarios: view them on your computer (offline) or via an external host which supports php.

ON YOUR COMPUTER
If you use windows, you have to install IIS (Internet Information Server) or PWS (Personal Web Server), if they're not already.
You will see if the installation is ok pointing you browser to http://127.0.0.1 (this is a special IP that identifies ALWAYS your machine, named LOCALHOST.

Then go to http://www.php.net/downloads.php and download the windows binary. If you're new to this kind of things, take the installer version.
After configuring php, what you need to do is:
- create a php file
- put it into some directory viewable by you web server
- view it via http
You cannot see php files simply double clicking on them: php is a server side language, so it has to be processed by the web server. This is why you can only see it pointing your browser, for example, to http://127.0.0.1/mydir/myfile.php
And finally, the code for a basic php test file (without the line numbers):

<?php
phpinfo
();
?>

If all is ok, this will print out an info page about your php installation.

ON EXTERNAL HOST WITH PHP SUPPORT
This is more easy: just copy your php file into you web space and look at it as usual ( http://myprovider/mydir/myfile.php ).

Hope this helps, have fun! ;)
Logged

Offline GaryCXJk

  • <strong>Official Charas.EX Team Member</strong>
  • Exemplar
  • *
  • Posts: 1,586
  • FOUR OH FOUR'D
    • Multiverse Works
(No subject)
« Reply #6 on: April 26, 2003, 11:54:53 AM »
W00T!!! I FINALLY FOUND OUT HOW NUSPHERE WORKS!!! NOW I CAN TEST PHP SCRIPT OFF-LINE!!!
Logged

Play it now! Charas Breakout DX
Area91: for MUGEN and RPG Maker VX Ace stuff

Offline GaryCXJk

  • <strong>Official Charas.EX Team Member</strong>
  • Exemplar
  • *
  • Posts: 1,586
  • FOUR OH FOUR'D
    • Multiverse Works
(No subject)
« Reply #7 on: December 02, 2003, 11:42:50 AM »
I'll kick this topic a bit.

You can download PHPDev on:

http://sourceforge.net/projects/phpdev5/
Logged

Play it now! Charas Breakout DX
Area91: for MUGEN and RPG Maker VX Ace stuff

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Off-Topic »
  • Archive »
  • Really Old Stuff »
  • PHP (Moderator: De KoFfieŠ) »
  • PHP questions
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum