Jump to content

Php files from mac os and windows problem


Go to solution Solved by Ch0cu3r,

Recommended Posts

This is from index.php

 

Error:

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\Sportify\index.php on line 258

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\Sportify\index.php on line 258

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Sportify\index.php on line 259

								echo "<div class='content-bottom'>
								<div class='box1' >";
									$result = mysql_query("SELECT * FROM product WHERE status = 'OPEN' ORDER BY id DESC");
									if(!$row = mysql_fetch_assoc($result))
									{
										echo "Sorry no item added!";
			
									}
									else 
									{
							
										$counter = 0;
										$max = 3;
										$result = mysql_query("SELECT * FROM product WHERE status = 'OPEN' ORDER BY id DESC");
										while ($row = mysql_fetch_assoc($result) and ($counter < $max))
										{
			
										$id = $row['id'];
										$prod_name = $row['prod_name'];
										$prod_price = $row['prod_price'];
										$prod_details = $row['prod_details'];
										$prod_imgname = $row['prod_imgname'];
							
									
										echo "<div class='col_1_of_3 span_1_of_3' style ='margin:14px;' ><a href='index.php?page=prod_details.php&id=$id'>
												 <div class='view view-fifth' >
												  <div class='top_box'>
													<h3 class='m_1'>$prod_name</h3>
													
													 <div class='grid_img'>
													   <div class='css3'><img src='image/$prod_imgname' width ='300px' height = '300px'/></div>
														  <div class='mask'>
															<div class='info'>Quick View</div>
														  </div>
													</div>
												   <div class='price'>RM $prod_price</div>
												   </div>
													</div>
												   <span class='rating'>
													<input type='radio' class='rating-input' id='rating-input-1-5' name='rating-input-1'>
													<label for='rating-input-1-5' class='rating-star1'></label>
													<input type='radio' class='rating-input' id='rating-input-1-4' name='rating-input-1'>
													<label for='rating-input-1-4' class='rating-star1'></label>
													<input type='radio' class='rating-input' id='rating-input-1-3' name='rating-input-1'>
													<label for='rating-input-1-3' class='rating-star1'></label>
													<input type='radio' class='rating-input' id='rating-input-1-2' name='rating-input-1'>
													<label for='rating-input-1-2' class='rating-star'></label>
													<input type='radio' class='rating-input' id='rating-input-1-1' name='rating-input-1'>
													<label for='rating-input-1-1' class='rating-star'></label> 
												  (45)
												  </span>
													 <ul class='list'>
													  <li>
														<img src='images/plus.png' alt=''/>
														<ul class='icon1 sub-icon1 profile_img'>
														  <li><a class='active-icon c1' href='#'>Add To Bag </a>
															<ul class='sub-icon1 list'>
																<li><h3>sed diam nonummy</h3><a href=''></a></li>
																<li><p>Lorem ipsum dolor sit amet, consectetuer  <a href=''>adipiscing elit, sed diam</a></p></li>
															</ul>
														  </li>
														 </ul>
													   </li>
													 </ul>
												</a></div>
											";
					
										$counter++;
		
										}
							
							
									}
		
					
								echo "<div class='clear'></div>
													</div>
													</div>
													</div>
													</div>
													";
					
								//stop
						}
						else
						{
							include($page);
							//include('home.php');
							//ECHO "hiiii.";
							?>
							<?php
						} 
						
					
			?>
  • Solution

Before using msyql_query you need to have opened a connection to mysql. This is most likely why you are getting that error message.

 

See mysql_connect documention for connecting to mysql.

 

NOTE use of mysql_* functions are deprecated meaning they are no longer supported and could be removed from future version of PHP. I strongly recommend you start converting your code over to PDO or MySQLi

this is the same error you had in your first thread on this forum. are you learning from your experience so that you don't repeat the same problems?

 

you also used the mysqli database functions in your second thread on this forum. why now go backwards using the msyql functions?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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