/    Sign up×
Community /Pin to ProfileBookmark

PHP Script : Search from mysql numbers

Hey guys i need a script with search value from mysql table i try to make some but i don’t have knowledge to write this script…
I know how will sound this .. but i need this script for lotto ?) the extraction is 20/80 numbers (1,2,3,4…80) and i need to know the combination number probability .

Here is my tabel structure

[URL=”http://imagizer.imageshack.us/v2/800x600q90/607/32wo.png”]http://imagizer.imageshack.us/v2/800x600q90/607/32wo.png[/URL]

And this is how i thought this script must look?

[URL=”http://imagizer.imageshack.us/v2/800x600q90/844/p1tv.png”]http://imagizer.imageshack.us/v2/800x600q90/844/p1tv.png[/URL]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 15.2014 — You'd probably be better off using two DB tables. One would hold the basic information about one lottery drawing, and the other would have one row per number drawn, with a foreign key to the first table, something like:
<i>
</i>drawing
=======
drawing_id (INT, PRIMARY KEY, AUTO-INCREMENT)
drawing_date
drawing_time

number_drawn
=============
drawing_id (INT, FOREIGN KEY TO drawing.drawing_id)
number (INT)

Then if you want to search for which drawings included 3 numbers (12, 17, and 25 in this example):
<i>
</i>SELECT drawing.*
FROM drawing
INNER JOIN number_drawn AS nd1 USING(drawing_id)
INNER JOIN number_drawn AS nd2 USING(drawing_id)
INNER JOIN number_drawn AS nd3 USING(drawing_id)
WHERE nd1.number = 12
AND nd2.number = 17
AND nd3.number = 25
Copy linkTweet thisAlerts:
@demonx94authorJan 15.2014 — [code=php]<?php

$conn = mysql_connect('IP', 'root', 'PASSWORD');
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("loto", $conn);
?>


[/code]

[code=php]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<login>Inregistreaza Numere:</login>
</head>

<body>
<form method="post">
<table>

<tr>
<td>Select ID:</td>
<td><input type="text" name="id" /></td>
</tr>
<tr>
<td>Number</td>
<td><input type="text" name="number" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" value="add" /></td>
</tr>
</table>
<?php
if (isset($_POST['submit']))
{

include 'db.php';

$id=$_POST['id'] ;
$number= $_POST['number'] ;

mysql_query("INSERT INTO number_drawn(id,number)
VALUES ('$id','$number')");


}
?>

<?php
include("db.php");

SELECT drawing.*
FROM drawing
INNER JOIN number_drawn AS nd1 USING(drawing_id)
INNER JOIN number_drawn AS nd2 USING(drawing_id)
INNER JOIN number_drawn AS nd3 USING(drawing_id)
WHERE nd1.number = 12
AND nd2.number = 17
AND nd3.number = 25

echo "</tr>";
}
mysql_close($conn);
?>

</body>
</html>
[/code]


I don't know how i integrate your code ... can anyone help me?

[code=php]Parse error: syntax error, unexpected T_STRING in /home/u433511535/public_html/loto/test/index.php on line 51 [/code]
×

Success!

Help @demonx94 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...