Jump to content

Beeeeney

Members
  • Posts

    193
  • Joined

  • Last visited

Posts posted by Beeeeney

  1. If it is dropdowns: Day, month & year, then catch it in an array and implode it:

     

    $day = $_POST['day'];
    $month = $_POST['month'];
    $year = $_POST['year'];
    
    $date = array($day, $month, $year);
    $date = implode('-', $date);
    

     

    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?

  2. 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!

  3. 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
    																 }
    
    
    														 ?>
    

  4. 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.

  5. 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.

  6. 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.

  7. // 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?

  8. 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?

  9. <?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.

  10. 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.

×
×
  • 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.