![]() |
|
|||||||||
|
|||||||||
|
| 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. |
|
||||||
| PHP DB Discutii despre lucrul cu baze de date in PHP. |
![]() |
|
|
Thread Tools | Moduri de afișare |
|
|
#1 |
|
32-Bit Member
|
Salut, am incercat sa fac si eu o mica ghidusie pentru un script gen blog, sa pot sa postez bloguri pe site-ul meu, acum problema a venit imediat.
Am testat conexiunea din scriptul php la mysql in felul urmator: // Incercarea de conectare la MySQL si afisarea mesajelor. if ($dbc = @mysql_connect ('mysql.lx.ro', 'wustory_lx_ro', '******')) { if (@mysql_select_db ('wustory_lx_ro')) { die ('<p>Baza de date nu a fost selectata deoarece: <b>' . mysql_error() . '</b></p>'); } } else { die ('<p>Conexiunea la baza de date MySQL nu sa putut face deoarece: <b>' . mysql_error() . '</b></p>'); } Sa ma conectez la baza de date am reusit, dar dupa conectare dupa cum observati mai sus am selectat si baza de date (am incercat sa creez una dar nu am reusit, imi spunea ca utilizatorul, adica eu, nu am dreptul de a creea o baza de date, si nu stiu daca am dreptul sa o si selectez. if (@mysql_query ('CREATE DATABASE myblog')) { print '<p>Baza de date a fost creata.</p>'; } else { die ('<p>Nu sa putut crea baza de date deoarece: <b>' . mysql_error() . '</b></p>'); } ^^^ asta a fost incercarea de a creea baza de date care a esuat, la fel ca si selectarea. * Acum ce ma intereseaza este urmatorul lucru, Daca scripturile de selectare a bazei de date, fie ea wustory_lx_ro care a fost creeata odata cu contul meu, fie alta, selectarea ei si crearea tabelelor din scripturi php merge si cum as putea face lucrul asta. Ca fara o gestionare a acestora nu cred ca voi reusii sa implementez codul php pentru gestionare a mesajelor din blog (salvare, stergere, editare, vizualizare, etc.) Si daca nu merge sa creez tabele din scripturi php, atunci le voi creea direct din mysql, dar cum le voi gestiona ? Va rog ajutati-ma care stiti si cunoaste-ti. Multumesc anticipat.
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? Last edited by Fluidy4Real; 19.10.2006 at 15:01:06. Motiv: Update la problema, acum am dat de alta ... |
|
|
|
| Sponsored Links |
|
|
#2 |
|
Banned
|
Nu poţi creea baze de date pe LX. Singura ta bază de date e: user_domeniulx_ro. Încearcă pe alt host, sau pe localhost
![]() wustory_lx_ro a fost creeat o dată cu contul. Poţi tabele. |
|
|
|
|
|
#3 |
|
32-Bit Member
|
Aha, oke deci un lucru sa lamurit, dar acum cum fac sa selectez baza de date wustory_lx_ro ??? ca nici asta nu am reusit. am scris eu codul sursa gresit ??? Nu prea le am cu php-ul inca mai invat
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? |
|
|
|
|
|
#4 |
|
Banned
|
Cod PHP:
Poate merge numai mysql_select_db ('wustory_lx_ro')
|
|
|
|
|
|
#5 | ||
|
32-Bit Member
|
Citat:
Uite, adaug tot codul sursa pentru scriptul asta, ca sa iti dai seama cam ce am vrut sa fac, poate asea te va ajuta sa imi explici si mie. Dupa ce il fac daca imi reuseste o sa il uploadez eu pe undeva, ca sa il poata folosi si alti utilizatori adaptat la nevoile lor. Citat:
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? |
||
|
|
|
|
|
#6 |
|
Banned
|
Nu înțelegi,
Cod PHP:
Trebuie să plec la școală, poate te mai ajută altcineva
|
|
|
|
|
|
#7 |
|
32-Bit Member
|
Oke o sa modific acum sa vad daca merge. Mersi mult si succes la scoala
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? |
|
|
|
|
|
#8 | |
|
32-Bit Member
Data înregistrării: 03.04.2006
Mesaje: 62
Rep Power: 7 ![]() |
Citat:
Cod PHP:
Cod PHP:
|
|
|
|
|
|
|
#9 |
|
32-Bit Member
|
Oke o sa modific acum sa vad daca merge. Mersi mult si succes la scoala
![]() Edit: A mers, mersi mult. acum ramane sa fac scriptul pentru introducerea datelor in baza de date, preluarea lor si restul
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? |
|
|
|
|
|
#10 | |||
|
32-Bit Member
|
Am depasit problema aia am facut in felul urmator:
Citat:
Acum am o alta problema Am creat scriptul pentru adaugarea blog-urilor si nu reuseste sa le adauge in baza de date. Scriptul arata asea: Citat:
Citat:
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? |
|||
|
|
|
|
|
#11 |
|
128-Bit Member
Data înregistrării: 09.09.2005
Locație: Iasi
Vârsta: 22
Mesaje: 538
Rep Power: 7 ![]() |
cu alte cuvinte, tu opreai executia scriptului cu die in cazul in care baza de date era selectata...asta se intampla cand copiezi mecanic un script de undeva si nu incerci sa intelegi ce face
...nu se naste nimeni invatat, dar chiar daca e gata-facut scriptul, incearca sa il intelegi..astfel vei invata
|
|
|
|
|
|
#12 |
|
32-Bit Member
|
Pai asta e problema ca incerc sa le inteleg, dar sunt prea multi termeni deodata care trebuie intelesi (eu nu am lucrat cu php pana acum, mai ales cu baza de date MySQL), daca stii vrun tutorial care explica funtiile din php, care sunt si ce fac ele, ca eu am cautat dar nu am gasit
, as ramane recunoscator.
__________________
Shaolin shadowboxing, and the Wu-Tang sword style
If what you say is true, the Shaolin and the Wu-Tang could be dangerous Do you think your Wu-Tang sword can defeat me? |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Moduri de afișare | |
|
|