Jump to content

Recommended Posts

Can someone help me get this working after moving to php 7 it as stopped working

<br><center>

      <style type="text/css">
  <!--

.menu_myButton {
	-moz-box-shadow:inset 1px 0px 0px 0px #54a3f7;
	-webkit-box-shadow:inset 1px 0px 0px 0px #54a3f7;
	box-shadow:inset 1px 0px 0px 0px #54a3f7;
	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #336595), color-stop(1, #D9EEF8));
	background:-moz-linear-gradient(top, #336595 5%, #D9EEF8 100%);
	background:-webkit-linear-gradient(top, #336595 5%, #D9EEF8 100%);
	background:-o-linear-gradient(top, #336595 5%, #D9EEF8 100%);
	background:-ms-linear-gradient(top, #336595 5%, #D9EEF8 100%);
	background:linear-gradient(to bottom, #336595 5%, #D9EEF8 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#336595', endColorstr='#D9EEF8',GradientType=0);
	background-color:#336595;
	-moz-border-radius:14px;
	-webkit-border-radius:14px;
	border-radius:14px;
	border:1px solid #124d77;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:Times New Roman;
	font-size:14px;
	font-weight:bold;
	padding:5px 15px;
	text-decoration:none;
	text-shadow:1px 3px 0px #154682;

}
.menu_myButton:hover {
	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #D9EEF8), color-stop(1, #336595));
	background:-moz-linear-gradient(top, #D9EEF8 5%, #336595 100%);
	background:-webkit-linear-gradient(top, #D9EEF8 5%, #336595 100%);
	background:-o-linear-gradient(top, #D9EEF8 5%, #336595 100%);
	background:-ms-linear-gradient(top, #D9EEF8 5%, #336595 100%);
	background:linear-gradient(to bottom, #D9EEF8 5%, #336595 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#D9EEF8', endColorstr='#336595',GradientType=0);
	background-color:#D9EEF8;
}
.menu_myButton:active {
	position:relative;
	top:1px;
}
div {
    opacity: 1.0;
}
div.menu_trans {
    opacity: 1.0;
}
div.menu_trans:hover {
    opacity: 1.0;
}

  -->
  </style>
 <span style="color:#ffffff;">  <div class="menu_trans">
<?php
      // try to force display_errors off
@ini_set('display_errors', false);

$host="***********"; // Host name
$username="********"; // Mysql username
$password="*********"; // Mysql password
$db_name="*********"; // Database name
$tbl_name="menu_link"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// Retrieve data from database
$sql="SELECT * FROM $tbl_name ORDER BY RAND()";
$result=mysql_query($sql);

// Start looping rows in mysql database.
while($rows=mysql_fetch_array($result)){


//echo $rows['name'];
echo urldecode($rows['name']);
}

mysql_close();
?>
</div> </span>   </center><br>

any help is apricated 

Link to comment
https://forums.phpfreaks.com/topic/312065-php-5-to-php-7/
Share on other sites

In case it helps, the PHP manual mentions the alternative functions to use in the place of your various "mysql_" calls. You just need to look the functions up in the manual. For example, the following page talks about mysql_connect and the potential alternatives: https://www.php.net/manual/en/function.mysql-connect.php


As gw1500se mentioned, the PDO alternative is going to be the way to go.
 

Also note that the following page provides more information about migrating from PHP 5.6 to 7:
https://www.php.net/manual/en/migration70.php

Of course, there may be other changes you'll need to make since it sounds like you were using an even older version of PHP. Note that there are several links under the "Appendices" heading for migrating from/to different PHP versions. Unfortunately, I don't know if there is a way to merge the different links so you can get all the information at once.

Link to comment
https://forums.phpfreaks.com/topic/312065-php-5-to-php-7/#findComment-1584088
Share on other sites

$dsn = "mysql:host=$host;dbname=$db;charset=$charset";

try {
		$pdo = new PDO($dsn, $user, $pass);
		$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
		$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch(PDOExeption $e) {
	echo "Connection failed: " . $e->getMessage();
}	

$query = $pdo->prepare("SELECT * FROM pages WHERE page_website = :site AND page_url = :purl ORDER BY page_id DESC LIMIT 0,1");
		$query->bindParam(":site", $site);
		$query->bindParam(":purl", $ident);
		$query->execute();

		while($row = $query->fetch(PDO::FETCH_ASSOC)) {		

There is something to get you started

Link to comment
https://forums.phpfreaks.com/topic/312065-php-5-to-php-7/#findComment-1584119
Share on other sites

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.