Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Help ! [MYSQL & php]


Priceless
 Share

Recommended Posts

Hey, I'am currently working on mafiawars.. roll play in counter-strike source.

 

I am working on printing "databases" into the php page. (query)

 

But my php skills sucks (need/want webinterface).

 

My table is small, and I really dont know how to make it any bigger.. here is my code :

<html>
<head>
<title></title>
</head>
<body>
<?php

$db_host = '';
$db_user = '';
$db_pwd = '';

$database = '';
$table = '';

if (!mysql_connect($db_host, $db_user, $db_pwd))
   die("Can't connect to database");

if (!mysql_select_db($database))
   die("Can't select database");

$result = mysql_query("SELECT * FROM {$table}");
if (!$result) {
   die("Query to show fields from table failed");
}

$fields_num = mysql_num_fields($result);

echo "<center><h1></h1></center>";
echo "<center><table border='5'><tr></center>";

for($i=0; $i<$fields_num; $i++)
{
   $field = mysql_fetch_field($result);
   echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
while($row = mysql_fetch_row($result))
{
   echo "<tr>";
   foreach($row as $cell)
       echo "<td>$cell</td>";

   echo "</tr>\n";
}
mysql_free_result($result);
?>
</body>
</html>

 

And if I need a stylesheet can someone give an example? Thanks folx! <3

 

How can I make it lager.. would be awesome to have something simular to HG bans, or something like that (without the vb template if possible)

Edited by Priceless
Link to comment
Share on other sites

I'am trying to print out the databases.. like okay, lets say sourcebans.. sourcebans prints of from database to yourlink/sourcebans/banlist.php or something like that. I want my database querys : from the database to a tabel on the page. (If you got another way to print out databases not in tables that would be 10 times better)

 

I want either the table to be in a bigger size or I want the table to be diffrent.

 

aka trying to make the template around the table and im trying to make the table appear another place, be a diffrent size & look better. and my current code sucks, and I havn't been much involved in php yet.

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.   Paste as plain text instead

  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.

 Share