Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Community Answers

  1. Muddy_Funster's post in how to insert the post id along? was marked as the answer   
    ok, change the following and let us know what it gives you:
     
     $id = $db->lastInsertId('id');    
    becomes
     
     $id = $db->lastInsertId(); var_dump('last-insert-id = '.$id);
  2. Muddy_Funster's post in how this logic work? form handling was marked as the answer   
    your if statement is too loose, all it's checking is:
    if jobtitle is empty, OR any other field has content then throw the error, you need to add some more complexity
     
    if($rjobtitle1 == '' &&( $rjobcompany1 != '' || $rjobcity1 != '' || $rjobfrom1 != '' || $rjobto1 != '')){ //this checks that if the jobtitle is empty AND anyother fields have any information in them then throw the error $error[] = "you need to add your job title to go with the company information"; } elseif($rjobtitle1 != '' && ($rjobcompany1 == '' || $rjobcity1 == '' || $rjobfrom1 == '' || $rjobto1 == '')){ //this checks that, if the jobtitle has content and none of the other fields have content then throw the error $error[] = "you have not told us some or all the info about the company that your job - {$rjobtitle1} - was with, please provide these details (all fields are required)"; } And so on.
  3. Muddy_Funster's post in getting error on submission was marked as the answer   
    You are trying to insert null values into columns that you have set in the DB to not accept null values. Either ensure every required field has a value or change the settings in the table if you want to allow null value submission.
  4. Muddy_Funster's post in Starting with PDO select statement was marked as the answer   
    Here's an example PDO Select statement for reference:
    $con = new PDO('lib:host=host;dbname=dbname','usr','pwd') $sql = "SELECT name FROM user WHERE UID = :uid"; $stmt = $con->prepare($sql); $stmt->bindParam(':uid',$id, PDO::PARAM_INT); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); var_dump($result); There are variants on how to bind parameters and how to fetch results, but this is the simplest way that is closest to what you already tried. I also altered the query to show one way of how you would bind a parameter to a prepared statement.
     
    Hope it helps some.
  5. Muddy_Funster's post in jQuery, Clone, Append was marked as the answer   
    Sorry, the Edit didn't update the link destination, it was still going to /2/ rather than the /3/ - https://jsfiddle.net/mphur5eq/3/ 
     
    If that doesn't update just change the /2/ in the address bat to /3/ and you're good to go.
  6. Muddy_Funster's post in Looking for a code takes the database and creates a page... was marked as the answer   
    What your asking for is a full end to end application.  Something that works right through from the DB data to the page design. Depending on what kind of time you have on your hands you have a couple of options. 
     
     
    > Pick something off the shelf to get the job done (like AppGini) - be prepared for hair pulling and a random code injected by the builder.
     
    > Commission someone to be built for you, The freelance board is a good start if you have some cash, or else you could try people per hour and hope for someone with both skill and a need to build their portfolio.
     
    > Learn a framework and build your own - make sure the framework you pick fits your needs and has good support, something like KendoUI would probably be a decent option.
     
    > Build your own from the ground up - just make sure you have stocked up on a lot of coffee and that you have no great love for sunlight, friends or fresh air.
  7. Muddy_Funster's post in keep dropdown value selected whatever it maybe ? was marked as the answer   
    You just put a conditional check into the loop as it's constructing the option list (assuming you have already dealt with getting the desired value such as 1999) and set the selected attribute when the loop matches the conditional.
    for($i=$start_year; $i<=$end_year; $i++){ if ($i == $valueFromDB){ echo "<option value='{$i}' selected='selected'>{$i}</option>"; } else{ echo "<option value='{$i}'>{$i}</option>"; } } you could even use a ternary operator to condense the if/else:
    ($i == $valueFromDB) ? echo "<option value='{$i}' selected='selected'>{$i}</option>" : echo "<option value='{$i}'>{$i}</option>";
  8. Muddy_Funster's post in Turning an array into a column was marked as the answer   
    Fist of all, compared to most of the regulars on this forum I am a rank amateur, so your praise is somewhat excessive.
    Now to the issue at hand: You just need to expand the query (and the string assignment) - I altered it to only select the scholarships column from the table as that was the only column you were working with in the previous code, change the query to this:
     
    **Change field names as appropriate - I'm guessing as to what TA, RA satisfaction and Rank actually apply to in your HTML table.**
    $ sql = <<<SQL_QRY SELECT   Scholarships AS colorCode,   University,   Country,   satisfaction AS HLStudiesRank,   Rank as overallRank,   TA AS immigration,   RA AS income, FROM   {$SETTINGS["data_table"] } WHERE   id>0 LIMIT 10 SQL_QRY; and then update the string append in the the while loop to include the other column values:
    $cTable .= "<tr>"; $cTable .= "<td style=color:{$thisColor['color']}>{$thisColor['word']}</td>"; $cTable .= "<td>{$row['University']}</td>"; $cTable .= "<td>{$row['Country']}</td>"; $cTable .= "<td>{$row['HLStudiesRank']}</td>"; $cTable .= "<td>{$row['overallRank']}</td>"; $cTable .= "<td>{$row['immigration']}</td>"; $cTable .= "<td>{$row['income']}</td>"; $cTable .= "</tr>"; Again, most of this is assumed and will need to be customised for your data.
  9. Muddy_Funster's post in mySQL, cannot get mysql to display my $var was marked as the answer   
    for debugging try adding the following in where you are trying to echo out the $row[$programtype]:
    if(array_key_exists($programtype, $row)){ echo $row[$programtype]; } else{ echo $programtype." Was not found as an array key.<br>"; var_dump($programtype); echo"<br><pre>"; var_dump($row); echo"</pre>"; }  
    This should show you the contents and overall string length of $programtype and also the key value pairs of $row array, letting you visually asses if there are any differences.  Also note that, as you are working with a php array and not directly with the MySQL table reference, case sensitivity is in effect.
  10. Muddy_Funster's post in Looping through PHP objects was marked as the answer   
    So what you have is an object containing an array of objects, you need to iterate through each level.
    so:
     
    $nameObj = $names->GetResult; foreach($nameObj as $nameArray){   foreach($nameArray as $dataObj){     echo $dataObj->ID;   } }
  11. Muddy_Funster's post in how to use the boolean in php with json response code was marked as the answer   
    You are very welcome, best of luck with the rest of your project.  
     
    If you are done could you mark the topic as answered please?
  12. Muddy_Funster's post in How to create a Adaptive design was marked as the answer   
    The problem is that Adaptive and Responsive are somewhat intertwined.  Adaptive isn't a new thing in and of itself, rather it is a refinement on the core offerings of Responsive.
     
    Try googling (or using any other search engine of choice) "RESS tutorials" instead I'm seeing plenty of results on that.
×
×
  • 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.