Phorum.ro
Your Avatar Welcome to Phorum.ro!
If you haven't registered yet, click here!
Attention Visitor:
You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Du-te înapoi   Phorum.ro > Web Design & Web Development > Programare > PHP > PHP DB

PHP DB Discutii despre lucrul cu baze de date in PHP.

Răspunde
 
Thread Tools Moduri de afișare
Vechi 07.07.2006   #1
SirPaladin
8-Bit Member
 
Data înregistrării: 07.07.2006
Mesaje: 2
Rep Power: 6
SirPaladin is on a distinguished road
Implicit MySQL, OO, problema enervanta

Cod PHP:
<?php


$db 
mysqli_connect('localhost','root','root');
mysqli_select_db($db,'vld');
$result mysqli_query('SELECT name FROM `guestbook`');
$row mysqli_fetch_array($result);

$i 0;
echo 
'Acesti oameni au postat in guestbook: ';

while (
$row mysqli_fetch_array($result)) {
echo 
$row['name'];
$i++;
}
mysqli_close($db
);

?>
Cod PHP:
<?php


$db 
= new mysqli('localhost','root','root','vld');
$result $db->query('SELECT name FROM `guestbook`');
$row $db->fetch_array($result);

$i 0;
echo 
'Acesti oameni au postat in guestbook: ';

while (
$row $db->fetch_array($result)) {
echo 
$row['name'];
$i++;
}
$db->close($db);

?>
Am urmat un tutorial si am facut un guestbook, putin adaptat la serverul meu. Am zis sa scriu aplicatia asta ca un exercitiu. Nu ar trebui sa fie nimic gresit, pt. ca in manualul meu, amandoua abordarile sunt descrise, si am respectat intru totul ce scrie acolo.
S-ar putea sa am greseli in sintaxa, pt ca am modificat putin textul aici, da` in fine. Nu imi merge. Cateodata nu se executa deloc partea cu bazele de date, cateodata nu merge nici macar marcajul <title> pe care il pusesem inaintea blocului de cod PHP.
In caz ca observati vreo problema cu oricare din abordari, va rog sa postati.
SirPaladin is offline   Reply With Quote
Sponsored Links
Vechi 07.07.2006   #2
Zeon
32-Bit Member
 
Data înregistrării: 10.05.2006
Mesaje: 167
Rep Power: 7
Zeon is on a distinguished road
Implicit

incearca:

Cod PHP:
$result mysqli_query("SELECT `name` FROM `guestbook`"); 
Zeon is offline   Reply With Quote
Vechi 08.07.2006   #3
SirPaladin
8-Bit Member
 
Data înregistrării: 07.07.2006
Mesaje: 2
Rep Power: 6
SirPaladin is on a distinguished road
Implicit

Citat:
În prealabil postat de Zeon
incearca:

Cod PHP:
$result mysqli_query("SELECT `name` FROM `guestbook`"); 
Nu e asta problema.
In fine, mi-a mers pana la urma. Merci oricum.
SirPaladin is offline   Reply With Quote
Răspunde


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Moduri de afișare

Reguli de postare
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Pornit
emoticoanele sunt Pornit
Codul [IMG] este Pornit
Codul HTML este Oprit



Ora este GMT +3. Ora este acum 01:44:57.


Rulează cu: vBulletin Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum SEO by Zoints

XXXXXXXXXXXXXXXXXXX
Inactive Reminders By Icora Web Design