-
Posts
522 -
Joined
-
Last visited
Everything posted by budimir
-
Hey guys, I have a query where I'm taking out only 4 rows of data. Now, my question is. How can I display each row in a different place on the page? For example: Row 1 - top left corner Row 2 - top right corner Row 3 - bottom left corner Row 4 - bottom right corner Help???
-
It works without the quotes. But anyway I figured it out. Below is the solution. $upit = "SELECT *, COUNT(naziv) AS broj2 FROM obilasci JOIN opcenito ON opcenito.id = obilasci.id WHERE datum BETWEEN '$_GET[timestamp]' AND '$_GET[timestamp1]' GROUP BY naziv"; Cheers guys
-
Hey guys, This is a new thing for me and I can't get to work. Can someone help? This is my query and is not working right now. $upit = "SELECT * FROM obilasci WHERE upisao = '$upisao' AND datum BETWEEN '$_GET[timestamp]' AND '$_GET[timestamp1]'"; When I take pute my upisao = '$upisao' clause, everything is OK, but I need to have that one too. Help, please...
-
The problem is in your kill.php. Can you post that code?
-
That's right you need to do this: if (($_POST['change_notes']) && ($_POST['notes'])){ $notes=strip_tags($_POST['notes']); if (isset($_POST['notes'])) { mysql_query("UPDATE users SET notes='$notes' WHERE username='$username'"); echo "Your notepad has been updated."; } else { do nothing } I thought you are going to notice that! Sorry...
-
Well there is a lot manuals about exporting data to excel or word or pdf files. Try to google a litlle bit. For Graphical ways (Pie charts, Bar graphs, Curves) you can use Open chart! Which is great looking charts and simple.teethgrinder.co.uk/open-flash-chart/
-
Try to google for "sticky forms", that will help you!
-
Maybe, you could use: if (isset($_POST[])){ mysql_query("UPDATE members SET notes='$notes' WHERE username='$username'"); echo "Your notepad has been updated."; } else { do nothing } I'm not quite sure what you're problem is, but maybe this can help
-
Try this if(mysql_num_rows($result_inv)>0){ $already_invited = 'true'; And also put your form in echo
-
Yes, and it's working proprely. You need to use else { some code } You did'nt tell the program what to do after, it's just showing true or not showing.
-
if ($iqid == $arr2[$iqid][$userid]){ continue with your code.... }
-
It looks good, except you didn't select DB. Write the code, and you will se the errors you'll get. Then it's mutch easier to troubleshoot...
-
Of course it's not working. Your are only selecting ID and then you made a link that is linking to that ID. Not NEXT or PREVIOUS You need to increase or decrease the ID for next or previous (or wathever you want to do) So you could do: $ID_higher = $user['userid']+1; $ID_smaller = $user['userid']-1; echo '<a href="viewuser.php?userid='.$ID_higher.'">NEXT ></a>'; echo '<a href="viewuser.php?userid='.$ID_smaller.'">PREVIOUS ></a>'; Now you need to get the correct ID... Work with it... That can be your starting point. Although this isn't a very good way to do it, but it will get you going...
-
Query SQL database and return specific fields
budimir replied to jaykappy's topic in PHP Coding Help
Also, a very good thing to do for all your queries would be to put a simple line which can help you a lot when you need to troubleshoot your queries, so try to do it like this: $results = mysql_query( $sql,$db_conn ) or die (mysql_error()); It will save you a lot of time in future... -
What exactly are you doing and where is the problem? The form is OK, and the variables are OK. But, what should it do? Sorry. There is a problem with the variables: In the = $_POST["here goes the name of the input field from the form"]
-
A trick to overcome header errors in utf-8 php file!
budimir replied to webster's topic in PHP Coding Help
Yeah, I know about it. I went nuts with script because of it. It will help some people, defenetly. Every modern editor has a support for enabling/disabling BOM. -
OK, so you need to do this: <?php $email = $_GET['email']; $passkey = $_GET['passkey']; $sql = "SELECT * FROM dbtable WHERE email = '$email' AND passkey='$passkey'"; $result = mysql_query($sql) or die (mysql_error()); $num = mysql_num_rows($result); if ($num > '0'){ echo "Go on!"; } esle { echo "STOP! Something is wrong."; } So this is very basic peace of code for the thing you need. Hope it helps?
-
Thanks, I have an idea now. Cheers
-
So what exactly do you want to do? As I can see, you have preventions here: //if the email is registered it gives an error if ($check3 != 0) { die('Sorry, '.$_POST['email'].' is already in use.'); } // checks for the passkey if (!get_magic_quotes_gpc()) { $_POST['passkey'] = addslashes($_POST['passkey']); } $passkeycheck = $_POST['passkey']; $checkpasskey = mysql_query("SELECT username FROM users WHERE passkey = '$passkeycheck'") or die(mysql_error()); $check4 = mysql_num_rows($checkpasskey); //if the email is registered it gives an error if ($check4 != 0) { die('Sorry, the passkey: '.$_POST['passkey'].' is already in use.'); } You are checking for the email and for the Registration key. Can you repeat what you want?
-
Here is where I'm getting $year and $month.. <?PHP $year = $_GET['year']; $month = $_GET['month']; ?> <table width="938" border = "0"> <tr> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2008<?PHP if ($month) echo "&month=$month" ?> ">2008</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2009<?PHP if ($month) echo "&month=$month" ?> ">2009</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2010<?PHP if ($month) echo "&month=$month" ?> ">2010</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2011<?PHP if ($month) echo "&month=$month" ?> ">2011</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2012<?PHP if ($month) echo "&month=$month" ?> ">2012</a></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=01">Siječanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=02">Veljača</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=03">Ožujak</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=04">Travanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=05">Svibanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=06">Lipanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=07">Srpanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=08">Kolovoz</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=09">Rujan</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=10">Listopad</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=11">Studeni</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=12">Prosinac</a></td> </tr> You are right, I will fix that code, but right now this is really bothering me...
-
Hey guys I'm having a small problem, An ID is not working in the first query, but in second is working. Anyone see where the problem is, because I can't find it? <?php $id = $_GET["id"]; if (isset($year) && isset($month)){ $upit = "SELECT * FROM obilasci WHERE YEAR(datum) = '$year' AND MONTH(datum) = '$month' AND id='$id'"; $rezultat = mysql_query($upit) or die (mysql_error()); $num = mysql_num_rows($rezultat); $i = 0; while ($i < $num){ $id = mysql_result($rezultat,$i,"id"); $datum = mysql_result($rezultat,$i,"datum"); $upisao = mysql_result($rezultat,$i,"upisao"); $napomena = mysql_result($rezultat,$i,"napomena"); $napomena_id = mysql_result($rezultat,$i,"napomena_id"); $datum1 = date("d.m.Y",strtotime($datum)); $datum2 = date("Y",strtotime($datum)); echo " <tr> <form name= 'form1' action='pregled_obilazaka_obrisi.php' method='post'> <input type='hidden' name='id' value='$napomena_id'> <td height='20'><div align='left'><em></em>$datum1</div></td> <td width='122'><div align='left'>$napomena</td> <td width='85'>$upisao</td> <td width='43'><a href='pregled_obilazaka_obrisi.php?id=".$napomena_id."'>Obriši</a></td> </tr>"; ++$i; } } else { $upit = "SELECT * FROM obilasci WHERE id='$id' ORDER BY datum DESC"; $rezultat = mysql_query($upit); $num = mysql_num_rows($rezultat); $i = 0; while ($i < $num){ $id = mysql_result($rezultat,$i,"id"); $datum = mysql_result($rezultat,$i,"datum"); $upisao = mysql_result($rezultat,$i,"upisao"); $napomena = mysql_result($rezultat,$i,"napomena"); $napomena_id = mysql_result($rezultat,$i,"napomena_id"); $datum1 = date("d.m.Y",strtotime($datum)); $datum2 = date("Y",strtotime($datum)); echo " <tr> <form name= 'form1' action='pregled_obilazaka_obrisi.php' method='post'> <input type='hidden' name='id' value='$napomena_id'> <td height='20'><div align='left'><em></em>$datum1</div></td> <td width='122'><div align='left'>$napomena</td> <td width='85'>$upisao</td> <td width='43'><a href='pregled_obilazaka_obrisi.php?id=".$napomena_id."'>Obriši</a></td> </tr>"; ++$i; } } ?> P.S. Please don't comment the code, it's form the begining, when I started learning!
-
It's quite simple! Can you post your code so we can show you?
-
Oh, never mind guys. I'm an idiot. So here is the complete code if somebody will need it. I works perfectly. Thanks a lot @spasme <?PHP $year = $_GET['year']; $month = $_GET['month']; ?> <table width="938" border = "0"> <tr> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2008<?PHP if ($month) echo "&month=$month" ?> ">2008</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2009<?PHP if ($month) echo "&month=$month" ?> ">2009</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2010<?PHP if ($month) echo "&month=$month" ?> ">2010</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2011<?PHP if ($month) echo "&month=$month" ?> ">2011</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2012<?PHP if ($month) echo "&month=$month" ?> ">2012</a></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=01">Siječanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=02">Veljača</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=03">Ožujak</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=04">Travanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=05">Svibanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=06">Lipanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=07">Srpanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=08">Kolovoz</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=09">Rujan</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=10">Listopad</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=11">Studeni</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=12">Prosinac</a></td> </tr> </table> <?PHP if ($year && $month) { $upit = "SELECT * FROM obilasci WHERE YEAR(datum) = '$year' AND MONTH(datum) = '$month'"; $rezultat = mysql_query($upit) or die (mysql_error()); while ($qry = mysql_fetch_array($rezultat)) { $id = $qry["id"]; } } else { echo "Please select both Year and Month"; } ?>
-
OK guys, Here is the code: <?PHP $year = $_GET['year']; $month = $_GET['month']; ?> <table width="938" border = "0"> <tr> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2008<?PHP if ($month) echo "&month=$month" ?> ">2008</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2009<?PHP if ($month) echo "&month=$month" ?> ">2009</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2010<?PHP if ($month) echo "&month=$month" ?> ">2010</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2011<?PHP if ($month) echo "&month=$month" ?> ">2011</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?year=2012<?PHP if ($month) echo "&month=$month" ?> ">2012</a></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=01">Siječanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=02">Veljača</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=03">Ožujak</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=04">Travanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=05">Svibanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=06">Lipanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=07">Srpanj</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=08">Kolovoz</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=09">Rujan</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=10">Listopad</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=11">Studeni</a></td> <td bgcolor="#fafafa"><a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=12">Prosinac</a></td> </tr> </table> <?PHP if ($year && $month) { $upit = "SELECT * FROM obilasci WHERE YEAR(datum) = '$year' AND MONTH(datum) = '$month'"; $rezultat = mysql_query($upit) or die (mysql_error()); while ($qry = mysql_fetch_array($rezultat)) { echo $qry["upisao"]; $b = $qry["id"]; echo "$b"; } echo "$b"; } else { echo "Please select both Year and Month"; } ?> The page is not displaying any data, whatever I click. When I copy/paste the query to phpmyadmin, everything is working fine. I can't figure out, what is wrong here??? Can you see it?
-
OK, this is my modified code: <?PHP $year = $_GET['year']; $month = $_GET['month']; ?> <a href="pregled_obilazaka.php?year=2008<?PHP if ($month) echo "&month=$month" ?> ">2008</a> | <a href="pregled_obilazaka.php?year=2009<?PHP if ($month) echo "&month=$month" ?> ">2009</a> | <a href="pregled_obilazaka.php?year=2010<?PHP if ($month) echo "&month=$month" ?> ">2010</a> | <a href="pregled_obilazaka.php?year=2011<?PHP if ($month) echo "&month=$month" ?> ">2011</a> | <a href="pregled_obilazaka.php?year=2012<?PHP if ($month) echo "&month=$month" ?> ">2012</a> <p> <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=01">Siječanj</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=02">Veljača</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=03">Ožujak</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=04">Travanj</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=05">Svibanj</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=06">Lipanj</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=07">Srpanj</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=08">Kolovoz</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=09">Rujan</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=10">Listopad</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=11">Studeni</a> | <a href="pregled_obilazaka.php?<?PHP if ($year) echo "year=$year" ?>&month=12">Prosinac</a> </p> <?PHP if ($year && $month) { $upit = "SELECT * FROM obilasci WHERE datum='$year' AND datum='$month'"; $rezultat = mysql_query($upit) or die (mysql_error()); while ($qry = mysql_fetch_array($rezultat)) { echo $qry[record]; } } else { echo "Please select both Year and Month"; } ?> But, my problem is in the fields in DB. This is example of the entry in DB: ID DATE NAME MESSAGE REF ID 12 2008-08-08 Ivica Makarovski A ivica je iÅ¡ao u... 23 Can we strip DATE so we could store into variable $year = 2008 and in $month = 08???? If I manage to do that, then it's done???