Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

How do I do this procedure using PDO?

Here's what I have currently:

$michelle="SELECT * FROM `gant` WHERE submitted_date<'$week_one_code' and target_UAT_date>'$week_one_code'";
		$michelle_query=mysqli_query($mysqli, $michelle);
		$michelle_count=mysqli_num_rows($michelle_query);
		if($michelle_count>0)
		{
		$donald="delete from gant_rows";
		$donald_query=mysqli_query($mysqli, $donald);
		//we don't need to display when the project was initally assigned, but we do need to know how many days it extends into the displayed 12 week timeframe
		while($michelle_row=mysqli_fetch_assoc($michelle_query))
		{
			extract($michelle_row);
			$UAT_date_initial_obj = strtotime($michelle_row['target_UAT_date']);
			$UAT_initial_secs=$UAT_date_initial_obj - $week_one;
			$the_number_of_initial_cells = number_format(($UAT_initial_secs / 86400), 0);
			etc...

Open in new window


I want to accomplish the same thing using PDO. Thus far I've got:

$sql_23="select * from net_BudgetTools..tbl_DEVELOPERS_Projects where dte_DateStarted <'2015-08-16' and dte_RequestorDueDate> '2015-08-16'";
$mssql_stmt_23=$mssql_pdo->query($sql_23);

while($row_23=$mssql_stmt_23->fetch(PDO::FETCH_ASSOC))
{
	//right here, I want to be able to pull data out using the PDO equivalent to extract($michelle_row) and then be able to reference specific data like before as far as $michelle_row['dte_DateStarted'] etc. How?
	$result_array_23[]=$row_23;
	$row_count_23=$row_count_23+1;
}

Open in new window


Bottom line: Right after "while($row_23=$mssql_stmt_23->fetch(PDO::FETCH_ASSOC))" I'm clueless. I've done the "foreach" thing previously, but I want to go with the "while" loop and then be able to extract things from there.

How?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

Julian!

As always, thanks for taking the time to weigh in.

Using your input, I was able to go in and make some changes and I'm good to go now.

Thanks!
You are most welcome Bruce,