• Help
  • Search
  • Login
  • Register
  • Home

Forum: web design and graphics community

Celestial Star Forum > Web Development > Coding > Adding layouts to database?
Pages: [1]
« previous next »
  Print  
Author Topic: Adding layouts to database?  (Read 2037 times)
surabhi
Angeling
*
Posts: 21



View Profile WWW
Adding layouts to database?
« on: July 14, 2005, 08:57:03 PM »

I probably sound really stupid but I'm confused.
I'm using this tutorial: http://www.daydreamgraphics.com/d/tutorial/list/210/2

How do I add the layouts? Should I use the form I make to submit each layout I have?  :roll:  OR do I edit:
Code:
<?php 
include &#40;'connection.php'&#41;; 
$query = "select * from `layouts` where category='$category' order by id desc"; 
$result= mysql_query&#40;$query, $connection&#41; or die 
&#40;"Could not execute query &#58; $query." . mysql_error&#40;&#41;&#41;; 

while &#40;$row=mysql_fetch_array&#40;$result&#41;&#41; 
&#123; 
$id=$row["id"&#93;; 
$name=$row["name"&#93;; 
$artist=$row["artist"&#93;; 
$artisturl=$row["artisturl"&#93;; 
$series=$row["series"&#93;; 
$category=$row["category"&#93;; 
$previewimage=$row["previewimage"&#93;; 
$download=$row["download"&#93;; 
$viewhtml=$row["viewhtml"&#93;; 

echo "<table border=\"1\" bordercolor=\"#000000\" width=\"100%\"><tr><td colspan=\"2\" align=\"center\"><strong>$name</strong></td></tr> 
<tr><td><img src=\"$previewimage\"></td> <td valign=\"top\">Made by&#58; <a href=\"$artisturl\">$artist</a><br>Series&#58; $series<br>Category&#58; $category</td></tR> 
<tr><td colspan=\"2\" align=\"center\">| <A href=\"$viewhtml\">Preview</a> | <a href=\"$download\">Download</a> | </td></tr> 
</table><br>"
; 
&
#125; 

?>


But I have a feeling that's not it! ^^
Logged

img]http://img.photobucket.com/albums/v495/sritri/Blends%20n%20Stuff/SIGGY.jpg[/img]
AzNPryDE15
Angeling
*
Posts: 2


View Profile WWW
Adding layouts to database?
« Reply #1 on: July 14, 2005, 09:31:09 PM »

hey you anyways i just learn how to do this to from that tutorial but on that tutorial they ask you to make that form calle addlayouts.php use that form
Logged
paine
Angeling
*
Posts: 7


View Profile
Adding layouts to database?
« Reply #2 on: July 17, 2005, 07:55:01 PM »

you can load myadmin and just click on your table and near the top you can press "insert" its the same thing.
Logged
Ryan
Angeling
*
Posts: 20



View Profile WWW
Adding layouts to database?
« Reply #3 on: July 25, 2005, 08:07:54 PM »

Actually, that is only part of the script. From what I can recall, thats only the viewing script. You need a form to input the data into the database table.
Logged

url=http://moonlit-magick.net]Moonlit-Magick.net[/url]
surabhi
Angeling
*
Posts: 21



View Profile WWW
Adding layouts to database?
« Reply #4 on: July 26, 2005, 01:34:14 PM »

I know ^^. I already have the form but when I add layouts, it only shows up as  |X| for the image and blank info field. 0_o
Logged

img]http://img.photobucket.com/albums/v495/sritri/Blends%20n%20Stuff/SIGGY.jpg[/img]
lulusoccer
Angeling
*
Posts: 19


View Profile
Adding layouts to database?
« Reply #5 on: July 26, 2005, 04:26:04 PM »

I just set up a layout database, and my form worked just fine, try posting the code to see anybody can help you here..

Also, is your table set up correctly? You may need to change it a little.
Logged
animeallen
Retribution
***
Posts: 194



View Profile
Adding layouts to database?
« Reply #6 on: July 27, 2005, 10:36:31 AM »

It took me quite a while to successfully follow the tutorial... I needed to tweak everything to make it work, show me the other parts and I'll try to see what's wrong...
Logged

img]http://img513.imageshack.us/img513/1668/yuitokyoaasignature8ma.jpg[/img]
surabhi
Angeling
*
Posts: 21



View Profile WWW
Adding layouts to database?
« Reply #7 on: July 28, 2005, 12:23:37 PM »

Ooops..Sorry!
Here's my layouts.php
Code:

<div align="center">
<?php
include &#40;'connection.php'&#41;; 
$category = $_GET['category'&#93;;
$query = "select * from `layouts` where category='$category' order by id desc"; 
$result= mysql_query&#40;$query, $connection&#41; or die 
&#40;"Could not execute query &#58; $query." . mysql_error&#40;&#41;&#41;; 

while &#40;$row=mysql_fetch_array&#40;$result&#41;&#41; 
&#123; 
$id=$row["id"&#93;; 
$name=$row["name"&#93;; 
$artist=$row["artist"&#93;; 
$artisturl=$row["artisturl"&#93;; 
$series=$row["series"&#93;; 
$category=$row["category"&#93;; 
$date=$row["date"&#93;; 
$previewimage=$row["previewimage"&#93;; 
$download=$row["download"&#93;; 
$viewhtml=$row["viewhtml"&#93;; 

echo "<table border=\"1\" bordercolor=\"#000000\" width=\"22%\"><tr><td colspan=\"2\" align=\"center\"><strong>$name</strong></td></tr> 
<tr><td><img src=\"$previewimage\"></td> <td valign=\"top\"><br><b>ID&#58; $id<br><b>Name&#58; $name<br><b>Artist&#58; <a href=\"$artisturl\">$artist</a><br><b>Series&#58; $series<br><b>Category&#58; $category<br>
<b>Added&#58; $date<br></td></tR>

<tr><td colspan=\"2\" align=\"center\">| <A href=\"$viewhtml\">Preview</a> | <a href=\"$download\">Download</a> | </td></tr> </b>
</table><br>"
; 


&
#125;

?>



and addlayouts.php
Code:
<form action="submitlayout.php" method="post">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="left">Name: </td>
<td>
<input type="text" name="namedesign" size="70">
</td>
</tr>
<tr>
<td height="25" align="left">Artist: </td>
<td height="25">
<input type="text" name="artist" size="70">
</td></tr>

<tr>
<td height="25" align="left">Artist URL: </td>
<td height="25">
<input type="text" name="artisturl" size="70">
</td></tr>
<tr>
<td height="25" align="left">Series: </td>
<td height="25">
<input type="text" name="series" size="70">
</td>
</tr>
<tr>
<td height="25" align="left">Category: </td>
<td height="25">
<select name="category">
<option name="Divs" value="Divs">Divs</option>
<option name="Table" value="Table">Table</option>
<option name="PopUp" value="PopUp">PopUp</option>
<option name="IFrame" value="IFrame">IFrame</option>
</select>
</td>
<tr>
<td height="25" align="left">Thumbnail: </td>
<td height="25">
<input type="text" name="previewimage" size="70">
</td>
<tr>
<td height="25" align="left">.ZIP File: </td>
<td height="25">
<input type="text" name="download" size="70">
</td>
<tr>
<td height="25" align="left">Index.html File: </td>
<td height="25">
<input type="text" name="viewhtml" size="70">
</td>
<tr><td>&nbsp;</td><td><input type="submit" name="submit" value="Submit"></td></tr>

</table></form>

and submitlayouts.php:
Code:
<?php 
include &#40;'connection.php'&#41;; 

$q="insert into layouts &#40;id,name,artist,artisturl,series,category,previewimage,viewhtml,download&#41; VALUES &#40;'','$namedesign','$artist','$artisturl','$series','$category','$previewimage','$viewhtml','$download'&#41;"; 
$result = mysql_query&#40;$q,$connection&#41;; 
if &#40;$result&#41; 
&#123; 
echo "Thank you, Layout has been added."; 
&
#125; 
?>

I'm thinking in submitlayout.php,
there should be something like insert into layout and someway to add to the category given. [/b]
Logged

img]http://img.photobucket.com/albums/v495/sritri/Blends%20n%20Stuff/SIGGY.jpg[/img]
animeallen
Retribution
***
Posts: 194



View Profile
Adding layouts to database?
« Reply #8 on: July 31, 2005, 03:52:01 AM »

and the database connection?
Logged

img]http://img513.imageshack.us/img513/1668/yuitokyoaasignature8ma.jpg[/img]
Melfina
Administrator
Valkyrie Randgris
*****
Posts: 1289



View Profile WWW
Adding layouts to database?
« Reply #9 on: July 31, 2005, 05:11:44 AM »

She included a connection.php file where she puts the connection stuff.

Once you make that form and once it's working good, yes, you submit all information and submit everytime you want to add a layout.

I'm not sure if this is what you're asking.
Logged


MySpace  ~ MySpace Codex ~ Rune Nifelheim
animeallen
Retribution
***
Posts: 194



View Profile
Adding layouts to database?
« Reply #10 on: July 31, 2005, 08:42:12 AM »

I dunno but you do make some point. I just wanted to know if maybe there are some mispellings or something, but now that you've mentioned it I'm clueless... :P
Logged

img]http://img513.imageshack.us/img513/1668/yuitokyoaasignature8ma.jpg[/img]
surabhi
Angeling
*
Posts: 21



View Profile WWW
Adding layouts to database?
« Reply #11 on: August 03, 2005, 06:48:03 PM »

My connection stuff was all right..
I figured out the problem.. I had some mistakes in layouts.php and submitlayouts page..  :wink:
Logged

img]http://img.photobucket.com/albums/v495/sritri/Blends%20n%20Stuff/SIGGY.jpg[/img]
Pages: [1]
  Print  
« previous next »
 
Jump to:  

  • Welcome, Guest
  • Members login
  • Register for free

General

  • General
  • New members
  • Announcements
  • Support / Suggestions

Art boards

  • Creative mediums
  • Requests and offers
  • Tutorials
  • Celestial Star tutorials

Web development

  • Coding
  • Web design
  • Advertisements / affiliation

Off-topic

  • The non-sense
  • Ententainment

Go up
eXTReMe Tracker
  • Valid XHTML
  • Valid CSS
Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC | Seo4Smf v0.2 © Webmaster's Talks
Loading...