Convert 1 page from mySql to PDO

Zamknięty Opublikowano 7 lat temu Płatność przy odbiorze
Zamknięty Płatność przy odbiorze

This should be a quick fix for a good programmer.

Please read instructions carefully.

I have 1 website that is working now. It uses the following code in MySQL and it works perfectly. I also have a NEW website that uses PDO. I would like this code converted to PDO so that it does the same thing, just written in PDO. I am going to hire, pay, and leave 5 star positive feedback for the first programmer who can deliver working code in PDO format. I understand very little about programming and this is why I cannot do this myself. Contract price is $5.00 or less. If you bid less, I will test your code first.

<form name='input' method='post' action=''>

<input type='hidden' name='userID' />

<div align="center"><?=$error?></div>

<table border=0 cellspacing=2 cellpadding="2" style='border:2px solid black;'>

<tr style="font-weight:bold">

<td><center>Name</th>

<th>Day</th>

<th>Date</th>

<th>Hrs. Worked</th>

<th>Description of Work </th>

<td>Submit</th>

<td>Remaining</th>

</tr>

<?php

if (isset($_POST['userID'])) {

mysql_query('

insert into timesheet set userID = ' . $_POST['userID'] . ',

day = "' . $_POST['day_' . $_POST['userID']] . '",

date = "' . $_POST['date_' . $_POST['userID']] . '",

hours = "' . $_POST['hours_' . $_POST['userID']] . '",

description = "' . $_POST['description_' . $_POST['userID']] . '",

status = 1,

worksite = "' . $info['worksite'] . '"

') or print(mysql_error() . '<br /><br />');

}

$userID = $info['ID'];

$i=1;

$query=mysql_query("SELECT firstname,lastname,hours,ID FROM `users` where type='volunteer' and worksite='".$info['worksite']."' ORDER BY 2,3 ASC");

while($row = mysql_fetch_assoc($query))

{

$select_hrs = mysql_query("select sum(hours) as completed_hours from timesheet where worksite='".$info['worksite']."' and status=1 and userID='".$row['ID']."'") or die(mysql_error());

$hrs = mysql_fetch_assoc($select_hrs);

$remaining_hours = $row['hours'] - $hrs['completed_hours'];

$date_query = "select date from timesheet where ID = (select max(ID) from timesheet where worksite='".$info['worksite']."' and status=1 and userID='".$row['ID']."') ";

//echo $date_query;die();

$select_date = mysql_query($date_query) or die("2".mysql_error());

$get_date = mysql_fetch_assoc($select_date);

if($remaining_hours > 0) {

?>

<tr bgcolor=<? $k = $i%2;

if($k == 1)

{ $color= "#FFFFFF"; }

else

{ $color = "#EBEDF3"; }

echo $color?> >

<td align='center'><?=$row['firstname']." ".$row['lastname']?></td>

<td align='center'>

<select name='day_<?php echo $row['ID'] ?>'>

<option value="Monday" <? if(date('N') ==1){ echo "selected";}?>>Monday</option>

<option value="Tuesday" <? if(date('N') ==2){ echo "selected";}?>>Tuesday</option>

<option value="Wednesday" <? if(date('N') ==3){ echo "selected";}?>>Wednesday</option>

<option value="Thursday" <? if(date('N') ==4){ echo "selected";}?>>Thursday</option>

<option value="Friday" <? if(date('N') ==5){ echo "selected";}?>>Friday</option>

<option value="Saturday" <? if(date('N') ==6){ echo "selected";}?>>Saturday</option>

<option value="Sunday" <? if(date('N') ==7){ echo "selected";}?>>Sunday</option>

</select>

</td>

<!-- <script>DateInput('date', true, 'DD-MON-YYYY')</script> -->

<td><script>DateInput('date_<?php echo $row['ID'] ?>', true, 'MM/DD/YYYY')</script></td>

<th bgcolor="green"><input name='hours_<?php echo $row['ID'] ?>' type="text" value="" size="6"</th>

</th>

<td><input name='description_<?php echo $row['ID'] ?>' type="text" value="" size="20"></td>

<td bgcolor="green"><input type='button' value='Submit' onclick='[login to view URL] = "<?php echo $row['ID'] ?>"; [login to view URL]();'></td>

<td align='center'><?=$remaining_hours?></td>

<!-- <td bgcolor="yellow"><input type="button" value="Time" onClick="javascript:window.location.href='[login to view URL]<?=$row['ID']?>'"></td>

</tr> -->

<?php

}

$i++;

}

?>

Projekty graficzne HTML PHP Projektowanie stron www

Numer ID Projektu: #12105324

O projekcie

5 ofert Zdalny projekt Aktywny 7 lat temu

5 freelancerów złożyło ofertę za ₹1010 w tym projekcie

SpencerNeitzke

I can have this done today. I have hundreds of hours of experience with PDO and understand how to implement it correctly.

₹600 INR w ciągu 1 dnia
(2 Oceny)
3.4
Maharramoff

Hi. Understood what you want. I often use PDO (MySQL) in my projects. I can make for you in max 2 hours.

₹600 INR w ciągu 1 dnia
(0 Oceny)
0.0
binapithadiya

I have 2 years of experience in PHP and database. Please give me an opportunity. I am new as freelancer so in my profile there is no project but I am doing job as software developer. I hope you will give me an oppor Więcej

₹1300 INR w ciągu 1 dnia
(0 Oceny)
0.0