Beeeeney
-
Posts
193 -
Joined
-
Last visited
Posts posted by Beeeeney
-
-
Is actually OP finding a solution with LIMIT clause here?
Sure, if you take some time and allocate it to reading the last 3 very short posts in this thread, you'll see.
-
Use something like:
SELECT * FROM 'tablename' ORDER BY 'dateadded' DESC LIMIT 3;
Also, your query won't be executed there. You need to use your variable "$sql" as the mysql query.
$sql = "Your Query"; $result = mysql_query($sql);
Then use your "$result" variable to echo the data.
-
But the internet said it would..
Someone else suggested this:
Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L]
-
I found this on Stackoverflow, apparently it works.
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php
-
-
Have you even attempted to do this on your own?
-
Hi,
This work..If I say its greater than zero.
$organiserid = 0; $query = "SELECT * FROM eventjobs WHERE organiserid = " . intval($_SESSION['userID']) . " LIMIT 10"; $result = mysql_query($query); $row = mysql_fetch_array($result); if ($organiserid > 0) { echo 'You have no events. Create an event.'; } else { {
But $organiserid IS 0. You told your code that it is 0.
I hope you find the help you need!
-
Stab in the dark, but try this:
<?php $query = "SELECT * FROM eventjobs WHERE organiserid = " . intval($_SESSION['userID']) . " LIMIT 10"; $result = mysql_query($query); $row = mysql_fetch_array($result); if (empty($result)) { echo 'You have no events. Create an event.'; } else { ?> <div class="eventjoblistings"> <div class="boardeventfield"> <div class="boardeventfieldintro"> <div class="boardeventdatatitle"> <?php echo (!empty($row['eventname'])) ? $row['eventname'] : ''; ?> </div> <div class="boardeventdata"> <?php echo (!empty($row['eventdetails'])) ? $row['eventdetails'] : ''; ?> </div> <div class="boardeventdatahalf"> <?php echo (!empty($row['eventlocation'])) ? $row['eventlocation'] : ''; ?>, </div> <div class="boardeventdatahalf"> <?php echo (!empty($row['eventcountry'])) ? $row['eventcountry'] : ''; ?> </div> </div> <div class="boardeventfielddetails"> <div class="boardeventdatasupplier"> <?php echo (!empty($row['supplier1'])) ? $row['supplier1'] : ''; ?> </div> <div class="boardeventdata"> <?php echo (!empty($row['supplierdetails1'])) ? $row['supplierdetails1'] : ''; ?> </div> <div class="boardeventdata"> <?php echo (!empty($row['budget1'])) ? $row['budget1'] : ''; ?> </div> </div> <div class="boardeventfielddetails"> <div class="boardeventdata"> <?php echo (!empty($row['supplier2'])) ? $row['supplier1'] : ''; ?> </div> <?php echo (!empty($row['details2'])) ? $row['details2'] : ''; ?> <div class="boardeventdata"> <?php echo (!empty($row['budget2'])) ? $row['budget2'] : ''; ?> </div> </div> </div> </div> <?php } ?>
-
Hi,
I haven't yet but when I just run a query it works fine.
Do I need to say that the organiserid is at standard "0". So if ID 350 is entered then this is different so it will display everything?
Or would I say its blank?
So this would echo the eventname.
<?php $query = "SELECT * FROM eventjobs WHERE organiserid = " . intval($_SESSION['userID']) . " LIMIT 10"; if ($result = mysql_query($query)) { $row = mysql_fetch_array($result); { ?> <div class="eventjoblistings"> <div class="boardeventfield"> <div class="boardeventfieldintro"> <div class="boardeventdatatitle"> <?php echo (!empty($row['eventname'])) ? $row['eventname'] : ''; ?>
if ($result = mysql_query($query)) {
Will always return false, seeing as you haven't assigned anything to $result.
-
You've told your code to echo something if a variable is empty, on a variable you haven't declared. Then you're asking why it's echoing.
-
Where do you define $organiserid?
-
Hi to all
I create a function for my password field but i have one problem.
I predefine 4 codes but the function allows me to use only the last, in this case is dddd.
Can anyone help me with this?
The code I wrote is:
function registrationCode($param,$extra=null) { $validCodes = array('aaaa','bbbb','cccc','dddd'); $bul = true; foreach($validCodes as $validCode) if(strtolower($validCode) == strtolower($param)) { $bul = true; if($tmp) $bul = false; //break; } else $bul = false; return $bul; }
Don't really see what you're trying to do but if you want to use one of the strings in that array for something then just use [0], [1], [2], etc.
-
That's line 58, just looking now, I'm not sure where "gv_recruitment" actually is. Where should I be putting that?
$result = mysql_query("SELECT * FROM gv_recruitment");
It's a table in your database. I don't know where you should be putting that.
-
I'm trying to get a script running which used to be on a different site, and I've been modifying bits and pieces (so far basically the link to the new location, and adding a new MySQL database to work with this), everything is starting to finally work, but then I got this error. I'm a newbie to PHP, and I can't seem to figure out what I need to fix. This code worked perfectly previously, and google isn't being too helpful. Any chance someone knows what I'm missing?
Error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/45/9484341/html/recruiting/recruitment.php on line 66
Line 66 to 79
while($row = mysql_fetch_array($result))
{
$tempName = $row['Name'];
$tempLink = $row['Link'];
$tempMS = $row['MessageSent'];
if ($tempMS == 0)
{
echo "<tr>";
echo "<td onclick=\"parent.location='deleteEntry.php?link=$tempLink&un=$userName&pw=$password'\">" . $tempName . "</td>";
echo "<td> <a href=" . $tempLink . " target=\"_blank\">" . $tempLink . "</a> </td>";
echo "</tr>";
}
}
echo "</table>";
Well according to that error, you've passed a boolean into your mysql_fetch_array() function. More specifically, $result.
Show me the code where you declared $result.
-
// This file is www.developphp.com curriculum material // Written by Adam Khoury January 01, 2011 // http://www.youtube.com/view_play_list?p=442E340A42191003
Did you follow a tutorial? Or copy and paste all of it?
-
the trickery is probably aided by the fact that if you type w3c.org php into your address bar it loads w3schools right off the bat, no search engine pages or anything.
The are masters of SEO.
-
Nor does it have anything AT ALL to do with the W3C.
A lot of people seem to think that it does.
-
W3C has php tutorials as well as tutorials for other languages. Can be useful to check various php functions
I think you're referring to w3schools. That's not really a fantastic resource mate.
-
Sorry, I'm still having trouble understanding. Maybe someone else can help.
-
Does anybody know how to implement in this form <textarea> ?
I want to use fallowing java-script code which automatically fills textarea with full page url nad I need for that a textarea with ID="message", but I am new in php
Could you clarify what exactly you need?
-
<?php if (isset($_POST['Submit'])) { // This will check to see if the form has been submitted $senders_email = $_POST['your_email']; // The person who is submitting the form $recipient_friend = $_POST['friend_email']; // The forms recipient mail($recipient_friend,"A message from $senders_email", "Dear $recipient_friend,\n\nYour friend $senders_email, found our site very useful, and thought you would be interested.\n\nPlease follow the link to view our site:\nhttp://www.your_sites_address.com\n\nThank You\n\nThe your_sites_address.com", 'From: "your_site" <your_email.com>'); if (isset($_POST['your_email'])) { echo "<br>Your friend $recipient_friend has been contacted <br><br>Thank you $senders_email"; }} ?> <form action="" method="POST"> <fieldset> <legend>Tell a friend</legend><br /> Your email<br /> <input type="text" name="your_email" value="Your email" /><br /><br /> Your Friends email<br /> <input type="text" name="friend_email" value="Your friends email" /> <input type="Submit" value="Tell a friend" name="Submit" /> </fieldset> </form>
Just had to post this for clarity.
-
Well I may use php, but I need to find out how to make it work, becuase I'm not able to make it work.
Any idea of why it is not working?
Thanks
You do have it installed on a local server, right?
-
There are access to forms that have already been written, but not on this website. Google it, or go learn some PHP. Not too hard to learn the basics. There are online tutorials everywhere. Some good stuff even on YouTube.
-
You have method="post" and on the next page, you're trying to get it with $_GET.
Why does name="name[]" value="2013-01-01" split the value up into an array?
in PHP Coding Help
Posted · Edited by Beeeeney
If it is dropdowns: Day, month & year, then catch it in an array and implode it:
Then you can just use the $date variable in your MySQL query to insert it into the database. This is the best way I know how. Maybe someone else knows a better solution?