Help
Search
Login
Register
Home
Forum: web design and graphics community
Celestial Star Forum
>
Español (Spanish Only)
>
Código / Desarrollo web
>
Porfavor ayuda de Database Layout
Pages: [
1
]
« previous
next »
Print
Author
Topic: Porfavor ayuda de Database Layout (Read 1618 times)
jordi_auron666
Angeling
Posts: 12
Porfavor ayuda de Database Layout
«
on:
June 21, 2006, 03:33:09 PM »
Ola a todos. E seguido muchos tutoriales en ingles de acer un layout con una base de datos y mi problema es el siguiente:
sigo cada paso; creo la tabla con sus datos... Despu?s pongo el c?digo este que te dan en el tutorial que segu?:
<?php
/*
Author: Jenny Huang
For: Seabreeze Designs
Description: This code fetches and prints out all the layouts in your mySQL database.
*/
//MySQL connection variables
$user="******";
$host="******";
$password="*****";
$database="******";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
//Which mySQL table to select from and in what order
$query = "select * from `layouts` order by id desc";
$result = mysql_query($query, $connection) or die ("Could not execute query : $query ." . mysql_error());
$rows = mysql_num_rows($result);
if ($rows=="0") { echo "No layouts found."; }
//Gets and assigns variables to array
while ($row=mysql_fetch_array($result)) {
$id=$row["id"];
$title=$row["title"];
$artist=$row["artist"];
$artisturl=$row["artisturl"];
$series=$row["series"];
category=$row["category"];
$type=$row["type"];
$size=$row["size"];
$date=$row["date"];
$previewimage=$row["previewimage"];
$download=$row["download"];
$preview=$row["preview"];
//Prints out results
echo "<table width=\"80%\"><tr>
<td colspan=\"2\"><h3>
$title
</h3>
</td>
</tr>
<tr>
<td width=\"150\">
<img src=\"$previewimage\">
</td>
<td valign=\"top\" align=\"left\">
ID:$id
<BR>Creator: <a href=\"$artisturl\">$artist</a>
<br>Date:$date
<br>Series: $series
<br>Category:$category
<br>Type:$type
<br>Size:$size
</td>
</tr>
<tr>
<td colspan=\"2\">
| <A href=\"$preview\" target=\"_blank\">Preview</a> | <a href=\"$download\">Download</a> |
</td>
</tr>
</table><br>";
}
?>
Y pongo mis datos de la base de datos y todo.
El tutorial termina aqui. No te dice ni donde debes meter este c?digo, ni como usarlo ni nada... Es decir que hago con esto? lo meto en mi index.php? y si quiero poner un layout nuevo lo hago desde la base de datos creando una nueva fila, pero como hago para que me aparezca?
espero no haber molestado con esta gran parrafada :roll: Solo quiero decir que esta web es la ostia! Y que gracias a ella aprendi a crear mis propios layouts y me anime a crear mi propia web de dise?os!
Logged
URL=http://imageshack.us]
[/URL]
Melfina
Administrator
Valkyrie Randgris
Posts: 1285
Porfavor ayuda de Database Layout
«
Reply #1 on:
June 21, 2006, 09:05:32 PM »
Hola,
Gracias
Pues simplemente pegas el codigo en una pagina nueva (por ejemplo, layouts.php) y al abrirla saldr? todo lo que metiste en la database. Para a?adir m?s layouts, pues si, entras en tu PHPMyAdmin, rellenas los campos y a?ades, actualizas la p?gina y ya estara alli.
Por supuesto, supongo que primero tendras que subir los archivos del layout (para el preview, el zip y tal) y luego rellenar los campos de la database.
Logged
MySpace
~
MySpace Codex
~
Rune Nifelheim
jordi_auron666
Angeling
Posts: 12
Porfavor ayuda de Database Layout
«
Reply #2 on:
June 22, 2006, 08:52:51 AM »
Muchas gracias Melfina! Ahora mismo lo hago ;)
Esque no tengo ni idea de mysql y de php solo se crear lo basico para una web... xD Por cierto tu usas este mismo sistema? O uno mas complejo?
Logged
URL=http://imageshack.us]
[/URL]
jordi_auron666
Angeling
Posts: 12
Porfavor ayuda de Database Layout
«
Reply #3 on:
June 22, 2006, 08:59:32 AM »
pues lo que me temia... me sale un error cuando abro la p?gina donde meti el c?digo... es este:
Parse error: parse error, unexpected '=' in /home/www/magic-dust.awardspace.com/lay.php on line 31
Que puedo acer?
Logged
URL=http://imageshack.us]
[/URL]
ran
Skogul
Posts: 36
Porfavor ayuda de Database Layout
«
Reply #4 on:
July 15, 2006, 06:40:29 PM »
nose como sera tu codigo, pero lo que podes hacer es justamente seguir la instruccion: unexpected '=' in /home/www/magic-dust.awardspace.com/lay.php on line 31
Busca en la linea 31 de la pagina en donde pegaste el codigo que muestra las layouts el "=" que esta de mas. Borralo, y proba a ver si anda.
Sino logras hacerlo funcionar,yo te recomiendo usar el script de
http://residentfantasy.com/
Una vez que lo instalas, es facil de integrarlo a tu pagina,
si no sabes como podes preguntarme ^^
Logged
seventeen and insane
aoistar
Angeling
Posts: 7
Porfavor ayuda de Database Layout
«
Reply #5 on:
July 21, 2006, 05:35:46 AM »
ups, melfi le dijo k metiese eso del post 1 en un archivo .php y k lo probase, ahora bien el error le da en lay.php, si miras el codigo k te peg? en el primer post, veras esto en la linea 31
Code:
1
<?php
2
/*
3
Author: Jenny Huang
4
For: Seabreeze Designs
5
Description: This code fetches and prints out all the layouts in your mySQL database.
6
*/
7
8
//MySQL connection variables
9
$user
=
"******"
;
10
$host
=
"******"
;
11
$password
=
"*****"
;
12
$database
=
"******"
;
13
$connection
=
mysql_connect
&
#40;$host,$user,$password)
14
or die &
#40;"couldn't connect to server"); $db = mysql_select_db($database,$connection)
15
or die &
#40;"Couldn't select database");
16
17
//Which mySQL table to select from and in what order
18
$query
=
"select * from `layouts` order by id desc"
;
19
20
$result
=
mysql_query
&
#40;$query, $connection) or die ("Could not execute query : $query ." . mysql_error());
21
$rows
=
mysql_num_rows
&
#40;$result);
22
if &
#40;$rows=="0") { echo "No layouts found."; }
23
24
//Gets and assigns variables to array
25
while &
#40;$row=mysql_fetch_array($result)) {
26
$id
=
$row
[
"id"
&
#93;;
27
$title
=
$row
[
"title"
&
#93;;
28
$artist
=
$row
[
"artist"
&
#93;;
29
$artisturl
=
$row
[
"artisturl"
&
#93;;
30
$series
=
$row
[
"series"
&
#93;;
31
category
=
$row
[
"category"
&
#93;;
32
$type
=
$row
[
"type"
&
#93;;
33
$size
=
$row
[
"size"
&
#93;;
34
$date
=
$row
[
"date"
&
#93;;
35
$previewimage
=
$row
[
"previewimage"
&
#93;;
36
$download
=
$row
[
"download"
&
#93;;
37
$preview
=
$row
[
"preview"
&
#93;;
38
39
//Prints out results
40
echo
"<table width=\"80%\"><tr>
41
<td colspan=\"2\"><h3>
42
$title
43
</h3>
44
</td>
45
</tr>
46
<tr>
47
<td width=\"150\">
48
<img src=\"$previewimage\">
49
</td>
50
<td valign=\"top\" align=\"left\">
51
ID:$id
52
<BR>Creator: <a href=\"$artisturl\">$artist</a>
53
<br>Date:$date
54
<br>Series: $series
55
<br>Category:$category
56
<br>Type:$type
57
<br>Size:$size
58
</td>
59
</tr>
60
<tr>
61
<td colspan=\"2\">
62
| <A href=\"$preview\" target=\"_blank\">Preview</a> | <a href=\"$download\">Download</a> |
63
</td>
64
</tr>
65
</table><br>"
;
66
&
#125;
67
68
?>
69
Code:
category=$row["category"];
y mas que kitar el "=" lo k habria k hacer es meterle el "$" k le falta a la variable, kedando
Code:
$category=$row["category"];
con eso seria suf. para k fuese bien... creo o.o
Logged
img]http://www.dokoku.com/foros/firmas/001.jpg[/img]
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General
=> New Members
=> Announcements
=> Support / Suggestions
-----------------------------
Contests
-----------------------------
=> Archive
===> Contests
===> Blend Challenges
===> SOTW
-----------------------------
Art Boards
-----------------------------
=> Creative mediums
=> Requests & offers
=> Tutorials
===> Celestial Star Tutorials
-----------------------------
Web Development
-----------------------------
=> Coding
=> Web Design
=> Advertisements / Affiliation
-----------------------------
Off-topic
-----------------------------
=> Entertainment
-----------------------------
Español (Spanish Only)
-----------------------------
=> General / Bienvenida
=> Anuncios / Ayuda
=> Código / Desarrollo web
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
Loading...