Jump to content

tandrli

New Members
  • Posts

    2
  • Joined

  • Last visited

tandrli's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry .. Wasn't home so I could not respond and test questions thanks for responding @Barand .. that is some new age shit (pardon my french) which I'm not even on the doorstep to comprehend ... well in do time... so one more question if I may .. Because when I run this PHP alone .. it works ok as it should .. but when I include it into index.php gives me DB error .. I ran it 2 days ago and it was working fine but now I only get a printout .. with no data config.php <?php $query=mysql_connect("localhost","root","111"); mysql_select_db("skola",$query); ?> list.php (config.php has correct connection data as I said it runs OK when I run list.php solo) <?php include('config.php'); $query1=mysql_query("select id, `SUcenika`, `Prezime`, `Ime`, `DatumRodjenja`, `SPol`, `MjestoRodjenja`, `DrzavaRodjenja`, `Prebivaliste`, `SOpcina`, `SIspit`, `SPrviPredmet`, `SDrugiPredmet`, `SJezikPolaganja`, `SPismoPolaganja`, `Odjeljenje` from upis"); echo "<table><tr><td>Skola</td><td>Prezime</td><td>Ime</td><td>DatumRodenja</td><td>Spol</td><td>MjestoRodenja</td><td>Drzava Rodenja</td><td>Prebivaliste</td><td>Opstina</td><td>Ispit</td><td>Prvi predmet</td><td>Drugi predmet</td><td>Jezik polaganja</td><td>Pismo polaganja</td><td>Odjeljenje</td><td></td><td></td>"; if($query1 === FALSE) { die(mysql_error()); // TODO: better error handling } while($query2=mysql_fetch_array($query1)) { echo " /<tr><td>".$query2['SUcenika']."</td>"; echo " /<td>".$query2['Prezime']."</td>"; echo " /<td>".$query2['Ime']."</td>"; echo " /<td>".$query2['DatumRodjenja']."</td>"; echo " /<td>".$query2['SPol']."</td>"; echo " /<td>".$query2['MjestoRodjenja']."</td>"; echo " /<td>".$query2['DrzavaRodjenja']."</td>"; echo " /<td>".$query2['Prebivaliste']."</td>"; echo " /<td>".$query2['SOpcina']."</td>"; echo " /<td>".$query2['SIspit']."</td>"; echo " /<td>".$query2['SPrviPredmet']."</td>"; echo " /<td>".$query2['SDrugiPredmet']."</td>"; echo " /<td>".$query2['SJezikPolaganja']."</td>"; echo " /<td>".$query2['SPismoPolaganja']."</td>"; echo " /<td>".$query2['Odjeljenje']."</td>"; echo " /<td><a href='delete.php?id=".$query2['id']."'>x</a></td><tr>"; } ?> tabela.html is HTML who has included php file list.php if ($login->isUserLoggedIn() == true) { include("tabela.html"); } else { //not loged in } ?> printout No database selected Skola Prezime Ime DatumRodenja Spol MjestoRodenja Drzava Rodenja Prebivaliste Opstina Ispit Prvi predmet Drugi predmet Jezik polaganja Pismo polaganja Odjeljenje also here is dump of db skola.zip
  2. hi .. hit little snag Ive got html <form name="formx" method="POST" action="connect.php" class='ajaxform'> and about 4 varibles in that form .. now how to properly query table users so i can find out which prefix correspond with that user Insert into table "upis" in this case that prefix with 3 variables.. everything in single,.. in this case connect.php file I know how to do QUERY and INSERT INTO but i don't know how to connect with 2 different tbl or db and do the query and input of data.. every time I put 2 of them together .. never works out.. this is example.. i dont know is this right way to do it .. so any guidence ... thnx <?php $rrr = $_POST['user']; $conn = mysql_connect("localhost", "root", "111"); if(! $conn ){ die('Could not connect: ' . mysql_error()); } $sql = 'SELECT prskola FROM users WHERE user_name = "' . $rrr. '"'; mysql_select_db('login'); $retval = mysql_query( $sql, $conn ); if(! $retval ){ die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { $value1 = $row['prskola']; echo "$value1"; // it works got correct data } mysql_close($conn); ?> <?php $skola=mysql_connect("localhost" , "root" , "111") or die (mysql_error()); mysql_select_db ("skola", $skola); error_reporting (E_ALL ^ E_NOTICE); $value2 = $_POST['data1']; $value3 = $_POST['data2']; $value4 = $_POST['data3']; $sql = "INSERT INTO `upis`(`col1`, `col2`, `col3`, `col4`) VALUES ('$value1', '$value2', '$value3', '$value4')"; mysql_query($sql, $skola); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.