MySQL - Alguien me puede ayudar

 
Vista:

Alguien me puede ayudar

Publicado por kokesoft (2 intervenciones) el 09/08/2014 16:34:13
hola a todos, tengo un poblemita, estoy creando una pagina web, parecida a la del millón de dolares, donde las personas pueden comprar pixeles publicitarios en bloques de 10x10, el problema es el siguiente.

quiero crear una pagina solo para república dominicana, pero el scrip que he descargado esta basado en la moneda de estados unidos, cuando se ingresan los parámetros altura y ancho el programa calcula automáticamente el precio, pero lo que quiero es que me calcule otro precio...

pueden entrar al siguiente link para que entiendan lo que le explico http://dosmillones.hol.es/buy.php
y reyenen los campos Width y Height automaticamente te tirara el precio al final donde dise price, lo que quiero es modificar ese precio...

aqui les dejo el codigo....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?php
include("header.php");
include("inner_header.php");
include("includes/configure.php");
include("includes/database_tables.php");
 
$x1=substr($_POST['x'],0,-1);
$y1=substr($_POST['y'],0,-1);
 
if($x1=="") $x1=0;
if($y1=="") $y1=0;
 
$q_block_price = mysql_query("SELECT block_price FROM " . TABLE_CONFIGURATION . " WHERE id=1");
$f_block_price = mysql_fetch_assoc($q_block_price);
$block_price = $f_block_price["block_price"];
 
 
?>
 
<script src="includes/general.js" language="JavaScript">
 
</script>
<script language="JavaScript">
 
function chk_form()
{
 
 
var flg = 1;
var str = "Please fill the following fields:\t";
str += "\n----------------------------------";
 
if((document.add_img_frm.name.value)==""){
str += "\n Name";
flg = 0;
}
if((document.add_img_frm.email.value)==""){
str += "\n Email";
flg = 0;
}
if((document.add_img_frm.width.value)==""){
str += "\n Width";
flg = 0;
}
if((document.add_img_frm.height.value)==""){
str += "\n Height";
flg = 0;
}
if((document.add_img_frm.url.value)==""){
str += "\n URL";
flg = 0;
}
if((document.add_img_frm.title.value)==""){
str += "\n Title";
flg = 0;
}
if((document.add_img_frm.upload_img.value)==""){
str += "\n Image";
flg = 0;
}
 
if(flg == 0){
alert(str);
return false;
}else{
if(!isValidEmail(document.add_img_frm.email.value)){
alert("Please check your email");
document.add_img_frm.email.focus();
return false;
}
if(isNaN(document.add_img_frm.width.value)){
alert("Widht field must be numeric");
return false;
}
if(isNaN(document.add_img_frm.height.value)){
alert("Height field must be numeric");
return false;
}
 
if(!chk_url(document.add_img_frm.url)){
return false;
}
 
//--------------------------------------------------------------------
 
if(document.getElementById('width').value <= 0){
alert("Width must greater than 0");
return false;
}
if(document.getElementById('height').value <= 0){
alert("Height must greater than 0");
return false;
}
 
var x1_val = document.add_img_frm.x1.value;
var y1_val = document.add_img_frm.y1.value;
var avail_x_dist = 100 - x1_val;
var avail_y_dist = 100 - y1_val;
if(document.add_img_frm.width.value > avail_x_dist){
alert("Horigental Blocks are not available.");
return false;
}
if(document.add_img_frm.height.value > avail_y_dist){
alert("Vertical Blocks are not available.");
return false;
}
 
var total_block = document.getElementById('width').value*document.getElementById('height').value;
var block_price = document.getElementById('block_price').value;
var total_amount = total_block*block_price;
document.getElementById('price').innerHTML="<b>$"+ total_amount +"</b>";
document.add_img_frm.amount.value = total_amount;
 
if(document.add_img_frm.amount.value != ""){
if(document.add_img_frm.amount.value <= 0){
alert("Please check width and height properly");
return false;
}
}
 
 
 
//------------------------------------------------------------------------------
 
 
}
width=document.add_img_frm.width.value;
height=document.add_img_frm.height.value;
x2=parseInt(document.add_img_frm.x1.value)+parseInt(width);
y2=parseInt(document.add_img_frm.y1.value)+parseInt(height);
document.add_img_frm.x2.value=x2;
document.add_img_frm.y2.value=y2;
}
 
function set_price()
{
if((document.add_img_frm.width.value!="")&&(document.add_img_frm.height.value!="")){
var flag = 1;
if(isNaN(document.add_img_frm.width.value)){
flag = 1;
}
if(isNaN(document.add_img_frm.height.value)){
flag = 0;
}
 
if(flag == 1){
//var total_block = document.getElementById('width').value*document.getElementById('height').value;
//var block_price = document.getElementById('block_price').value;
 
 
var total_block = document.add_img_frm.width.value*document.add_img_frm.height.value;
//var block_price = document.getElementById('block_price').value;
 
var block_price = document.add_img_frm.block_price.value;
var total_amount = total_block*block_price;
document.getElementById('price').innerHTML="<b>$"+ total_amount +"</b>";
//document.add_img_frm.price.value="<b>$"+ total_amount +"</b>";
//document.add_img_frm.pp.value=total_amount;
 
document.add_img_frm.amount.value = total_amount;
}else{
//document.getElementById('price').innerHTML="Not yet calculated";
}
 
}else{
//document.getElementById('price').innerHTML="Not yet calculated";
}
}
 
 
</script>
 
<form name="add_img_frm" method="post" action="order_confirm.php" enctype="multipart/form-data" >
<table align="center" width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" bgcolor="#000077" align="center" class="white_text_heading">Add
Your Image Link</td>
</tr>
<tr>
<td >
<table width="100%" border="0" cellpadding="0" cellspacing="6" bgcolor="#DFDFDF" class="black_simple">
<tr>
<td height="10">&nbsp;</td>
<td height="10">&nbsp;</td>
</tr>
<tr>
<td width="54%" height="25" >&nbsp;Contact Name</td>
<td width="46%" height="25"><input name="name" type="text" id="name" class="black_simple"></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;Email address</td>
<td height="25"><input name="email" type="text" id="email" class="black_simple" ><!--input name="email" type="text" id="email" class="black_simple" onChange="if(!isValidEmail(this.value)) { chng_col(this); }else { back_col(this)};" --></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;x1 Position</td>
<td height="25"><?php echo $x1; ?></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;y1 Position</td>
<td height="25"><?php echo $y1; ?></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;Width</td>
<td height="25"><input name="width" type="text" id="width" class="black_simple" onChange="set_price();" onKeyUp="set_price();">
Block(s) </td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;Height</td>
<td height="25"><input name="height" type="text" id="height" class="black_simple" onChange="set_price();" onKeyUp="set_price();">
Block(s)</td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;Link to website</td>
<td height="25"><input name="url" type="text" id="url" class="black_simple"></td>
</tr>
<tr>
<td width="54%" height="25"> &nbsp;Message Box(50 Characters
max) </td>
<td height="25"><input name="title" type="text" id="title" maxlength="50" class="black_simple"></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;Pixel(s) Image</td>
<td height="25"><input name="upload_img" type="file" id="upload_img" class="black_simple"></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;Price :</td>
<td height="25"><input type="hidden" name="amount" id="amount"><div id=price></div></td>
</tr>
<tr>
<td width="54%" height="25">&nbsp;</td>
<td height="25"><input type="submit" name="paypal" value="Paypal" class="button" onClick="return chk_form()">
&nbsp;&nbsp;
<input type="reset" name="reset" value="Reset" class="button">
 
<input type="hidden" name="x1" id="x1" value="<?php echo $x1; ?>">
<input type="hidden" name="y1" id="y1" value="<?php echo $y1; ?>">
<input type="hidden" name="x2" id="x2" >
<input type="hidden" name="y2" id="y2" >
<input type="hidden" name="block_price" value="<?php echo $block_price; ?>">
 
</td>
</tr>
<tr>
<td height="10">&nbsp;</td>
<td height="10">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></form>
<script language="JavaScript">
document.getElementById('price').innerHTML="Not yet calculated";
</script>
<?php
include("inner_footer.php");
include("footer.php");
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Oscar

Alguien me puede ayudar

Publicado por Oscar (9 intervenciones) el 09/08/2014 17:03:20
Todo este código de php esta muy bien pero el precio lo tienes en la BBDD de MySQL buscalo y modificalo en ella..

PD:

La próxima vez intenta escribir tú el código y no hacer un copy/paste
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Alguien me puede ayudar

Publicado por kokesoft (2 intervenciones) el 09/08/2014 17:42:35
aqui esta la base de datos......la he modificado de todas formas pero nada...

# Table structure for table `million_configuration`
#

CREATE TABLE `million_configuration` (
`id` int(5) NOT NULL auto_increment,
`paypal` varchar(100) NOT NULL default '',
`block_price` int(5) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;

#
# Dumping data for table `million_configuration`
#

INSERT INTO `million_configuration` VALUES (1, '[email protected]', 100);
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar